in reply to Re: Named array indices (packages)
in thread Named array indices

Note that a C' prefix is a horrible idea:

Well the problem is the same for double colon syntax.

I would need relative package paths but can't achieve them easily.

I couldn't even make something like $arr[__PACKAGE__::C::Index] or $arr[__PACKAGE__.'::C::Index'] expand correctly at compile time.

So BUK has a point to use underscore prefixes!

Anyway my intention to use a package for the array indices was to avoid polluting the package namespace with constants which should only be associated and encapsulated to special datastructures.

I'm not completely understanding the code you're showing, looks like your globally importing the constants into the package and facilitating the initialization of the index-values. (As a side node there is constant::lexical2 on CPAN)

Thanx!

Cheers Rolf

UPDATE: did clarification of two phrases.