Phoenix.pm: quoting constant hash keys survey
Scott Walters
scott at illogics.org
Sat Apr 17 16:36:12 CDT 2004
In that case, I'm sorry to break the news to you that %hash<<foo>>
is probably here to stay... that one I don't care for. Since
subscripting with a constant is so much more common than subscriting
with the return value of a function call, i think %foo{shift}
should stay %foo{'shift'} and not be made into %foo{shift}. When
you actually really do want to call a function, write %foo{shift()}.
Better to require two extra characteres in the uncommon case
compared with the two extra characters in the common case
(%foo{'shift'} and %foo<<shift>> are the same number of characters,
two more than %foo{shift}).
I have to say that . in JavaScript is nifty -
document.forms.myform.submit()
is the same as
document["forms"]["myform"].submit()
So which one is simpler is argueable ;)
Seriously, thanks for your opinion. And for the record, I haven't
voiced my opinions on ` yet, other than agreeing that %hash<<foo>>
kind of sucks.
-scott
On 0, Andrew Johnson <aj at exiledplanet.org> wrote:
>
> Scott Walters wrote:
>
> Scott, I can tell you without hesitation that I /hate/ this. Mostly for
> the cons you've already specified.
>
> [snip]
>
> >Cons:
> >
> >* %foo`bar doesn't look like a hash subscript if you're used to %foo{'bar'}
> >
> >* Could be used to write really terse code
> >
> >* Ugly
> >
> >* Perl 6 already has 2 ways to subscript hashes now, 3 is too many
> >
> >
> >
> I agree wholeheartedly here, and with the poster that said, "call it
> something besides Perl 6." One of the goals of Perl 6 was supposed to
> be a /decreased complexity/ in certain areas. Elimination of synonyms,
> removal of old cruft. Having the backtick suddenly be the hash
> subscript operator is bad because most people now see the backtick and
> think "shell command." With this, now they'll have to think, "shell
> command unless there's only one, then it's a hash key." And hash keys
> are everywhere in most large Perl 5, and my impression is they'll
> continue to be in Perl 6. This is too much alienation of the existing
> Perl programmer community.
>
> And it is very ugly, IMHO, the ` and the << >> syntax. And if Perl 6
> does indeed already have 2 ways to subscript hashes, adding a third
> violates the simplification though synonym elimination.
>
> >* People who really want something like that can extend the language using Perl 6's
> >equivilent to source filters
> >
> >
> >
> Agreed.
>
> Don't get me wrong here: I like the idea of re-evaluating things in the
> language. But there are several things in Perl 6 I don't like because I
> think they go too far, and if this were implemented, I'd add it to the
> "don't like" list immediately.
>
>
More information about the Phoenix-pm
mailing list