chromatic skribis 2004-04-14 12:32 (-0700):
> That's exactly my objection to this idea.  I think it goes too far to
> make simple things simpler while making complex things impossible.

Absolutely false.

This is an addition to the already existing {}, which should stay.
%foo{ something } will still be necessary if:

* the key is the result of an expression
* you want a slice
* the key is not a string
* the key is a string that isn't simple enough (i.e. contains \W in a
way that isn't supported)

> I really don't want to explain why there are two hash key access
> mechanisms, one that only works for single keys that match a very
> simplified regular expression and one that works for one or many hash
> keys with no restrictions.

There are already two. One that works with expressions and one that
works for one or many hash keys as long as they are literals.

%foo<<$bar>> doesn't quite do the same as %foo{$bar}.

> Simplicity is good, yes.  Huffman coding is also good.  But you have to
> balance them with consistency of expression, usage, and semantics.

I agree.

> I don't think this proposal does the latter.

I disagree.

> On the other hand, if you prod Luke Palmer, he can probably write a
> macro to make this syntax work for you in under ten minutes and three
> messages.  In that case, it may not be a core feature, but you can have
> it for very nearly free.

Or I could use something that modifies the grammar Perl uses. Almost any
syntax feature can be added outside the core. I'm not exploring the
possibility of this operator, but suggesting that it be in the core.

This operator is possible, improves readability, eases typing and does
not clash with something that already exists.

Yes, it does mean learning the meaning of one more character. I think
every programmer is able to cope with that. Even beginners.


Juerd

Reply via email to