On Thu, Apr 15, 2004 at 12:27:12PM -0700, Scott Walters wrote:
Let me summerize my undestanding of this (if my bozo bit isn't already irrevocably set):

* %hash<<foo>> retains the features of P5 $hash{foo} but does nothing to counter the damage of removal of barewords

Actually, %hash<<foo>> will be like p5's $hash{"foo"}, and more generally %hash<<foo bar>> is @hash{qw(foo bar)}, if I'm not terribly mistaken.


It's plain %hash{foo} that's affected.

So to summarize, the following would be equivalent:

%hash{"foo"}
%hash<<foo>>
%hash`foo


* %hash`foo occupies an important nitch, trading features (slice, autovivication) to optmize for the common case, undoing the pain of the loss of barewords, serving as even a superior alternative

Autovivication is still possible, though the exact details would need to be worked out. (Either always autovivify as hash, or make it dependent on whether the key matches /^-?\d+\z/ )


But indeed, this is my best argument too: hashes are one of perl's top core features, and indexing with constant words or simple scalar variables are the most common ways of using them. It's used so much that by the huffman principle it deserves very short and convenient notation.


* %hash`foo can be added by the user, but users are seldom aware of even a small fraction of the things on CPAN and there is a sitgma against writing non-standard code

I fear that very much too. I'd probably not use the syntax either in public code (like CPAN modules) if it required a non-core module, since it would be silly to require an external module just for syntax "sugar".


Instead, I'd just be annoyed at it being non-core.


* %hash`foo and %hash ~ `ls` can coexist without breaking anything as this is currently illegal, unused syntax

* %hash`s is an example of a small thing that would be easy to implement in core but would be used constantly, giving a lot of bang for the buck

* Rather than eliciting public comment on %hash`foo the proposal is being rejected out of hand

Exactly. Juerd may have accidently aggrevated the situation by implying in his original post that %hash`key requires the removal of ``. It's clear now that the two issues are separated and should be discussed separately.


In case it's not obvious, I'm very much in favor of %hash`foo. (I'm not entirely sure yet how I feel about removing ``... maybe just leave it until a better application for those ticks can be found)

--
Matthijs van Duin  --  May the Forth be with you!

Reply via email to