On Thu, 2002-07-25 at 03:12, [EMAIL PROTECTED] wrote:
> Aaron Sherman <[EMAIL PROTECTED]> writes:
 
> >     my @x is Hashed::ByValues = (1,2,3);
> >     %h = (@x => 1);
> >     @x[1] += 4;
> 
> Personally I don't like the C< is Hashed::ByValues > because it smacks
> of spooky action at a distance; I much prefer my notion of C< %h{*@x}
> = 1>. And in Perl 6 I have the horrible feeling that C<< %h = (*@x =>
> 1) >> would expand to C<< %h = (1,2,3 => 1) >>, leading to a hash that
> looks like C< { 1 => 2, 3 => 1 } >. Or does the pair constructor
> force a scalar context on its lhs?

Please, don't get me wrong. I prefer the modifier on the hash as well.
But, my point was to show that there is nothing stopping a module author
from doing this, and there need be no support in the core other than
being able to override the hashing methods on any given object. There
will have to be a "$x.hashkey" or the like, I would think anyway, no?

> > %h{[1,2,3]} should still be 1, not undefined. 
> 
> You see, *this* is why I don't like your proposed notation. You
> declared @x as hashed by value, not %h itself, so C<
> !exists(%h{[1,2,3]})>. Use C< %h{*[1,2,3]} > and intent is made clear
> at the point of use. Which is nice.

All true.


Reply via email to