I've updated Damian's Perl6::Variables module to treat %foo{bar} as %foo{bar()} and to handle %foo<<bar>> and %foo<<bar baz>>. If this syntax is finalized, I'll send Damian a patch.
This is at: http://www.cpan.org/modules/by-authors/id/S/SW/SWALTERS/Perl6-Variables-0.02_001.tar.gz http://slowass.net/~scott/Perl6-Variables-0.02_001.tar.gz I'm eager to hear if %foo<<bar>> becomes permanent. Bug reports welcome. I'm not supporting the utf-8 version of << >> because all of my software handles them incorrectly in different ways but if there is enough demand, I might accept a patch. (Just kidding, I will accept a patch). -scott PS: The other thing I was threatening to write, hyper operators in P5 via overload and hyper keyword, well, I couldn't quite get it to work in a useful way. Couldn't figure out how to get real arrays out of an over loaded op, and from what I know about P5, I don't think it is possible. You can do whatever you like with this excpet time-shift it or view it on Linux. On 0, Larry Wall <[EMAIL PROTECTED]> wrote: > > On Mon, Mar 15, 2004 at 11:56:26AM -0700, John Williams wrote: > : On Wed, 10 Mar 2004, Larry Wall wrote: > : > You subscript hashes with {...} historically, or these days, «...», > : > when you want constant subscripts. So what you're looking for is > : > something like: > : > > : > if / <?foo> ... <?baz> ... { $?foo{'baz'} ... $?baz } .../ > : > or > : > if / <?foo> ... <?baz> ... { $?foo«baz» ... $?baz } .../ > : > : I'm probably a bit behind on current thinking, but did %hash{bareword} > : lose the ability to assume the bareword is a constant string? > > It's thinking hard about doing that. :-) > > : And why «»? Last I heard that was the unicode version of qw(), which > : returns an array. Using an array constructor as a hash subscriptor is > : not a "least surprise" to me. > > We'd be trading that surprise for the surprise that %hash{shift} doesn't > call C<shift>. Plus we get literal hash slices out of it for free. > Plus it also works on pair syntax :foo«some literal words». And probably > trait and property syntax as well. > > And basically because I decided :foo('bar') is too ugly for something > that will get used as often as switches are on the unix command line. > The %hash syntax is just a fallout of trying to be consistent with > the pair notation. Once people start seeing :foo«bar» all over, > they won't find %hash«bar» surprising at all, and will appreciate the > self-documenting literalness of argument. > > And unfortunately it's an unavoidable part of my job description to > decide how people should be surprised. :-) > > Larry