> I think the idea that => is "just another comma" is pretty widespread
> now.
Just for the record I've always thought this was stupid. That's just my
opinion, true, but there's a fine line between TMTOWTDI and pure
confusion.
IMO, if you're going to have a different operator, make it do something
different. Especially something as stand-out as =>, which many people
confuse with -> already.
What I'd like to see this RFC say instead of/in addition to the PAIR
idea is that => can be used to create hashrefs without having to have
{}. So these two would be equivalent:
@foo = ( { one => two }, three, four );
@foo = ( one => two, three, four );
I know, I know, the => doesn't really have anything todo with how hashes
are built. However, its widespread use in this syntax sure makes people
think it does.
This wouldn't change the key/value idea, you could still get to the data
with it:
$foo = $key => $value;
$foo->{$key}; # $value
key $foo; # $key
value $foo; # $value
# these are the same
value $foo = $value2;
$foo->{$key} = $value2;
# what key does is rename the existing key
key $foo = $key2; # like delete $foo->{$key}, then
# $foo->{$key2} = $value
Or something like that. The RFC touches on this, but I think it should
just go all the way and make => into its own operator.
-Nate
- Re: RFC 84 (v1) Replace => (stringifying comma)... Jon Ericson
- Re: RFC 84 (v1) Replace => (stringifying co... Chaim Frenkel
- Re: RFC 84 (v1) Replace => (stringifying comma)... Nathan Wiger
- Re: RFC 84 (v1) Replace => (stringifying co... John Porter
- Re: RFC 84 (v1) Replace => (stringifying comma)... John Porter
- Re: RFC 84 (v1) Replace => (stringifying comma) with... Chaim Frenkel
- Re: RFC 84 (v1) Replace => (stringifying comma) with... Damian Conway
- Re: RFC 84 (v1) Replace => (stringifying comma)... Piers Cawley
- Re: RFC 84 (v1) Replace => (stringifying co... Piers Cawley
- Re: RFC 84 (v1) Replace => (stringifyin... Ken Fox
- Re: RFC 84 (v1) Replace => (stringi... Nathan Wiger
- Re: RFC 84 (v1) Replace => (stringifying comma) with... Glenn Linderman
- Re: RFC 84 (v1) Replace => (stringifying comma)... Bart Lateur
- Re: RFC 84 (v1) Replace => (stringifying co... Glenn Linderman
- Re: RFC 84 (v1) Replace => (stringifying comma)... Mark Cogan
- Re: RFC 84 (v1) Replace => (stringifying comma) with... Damian Conway
- Re: RFC 84 (v1) Replace => (stringifying comma)... Glenn Linderman
- Re: RFC 84 (v1) Replace => (stringifying co... Peter Scott
- Re: RFC 84 (v1) Replace => (stringifyin... Glenn Linderman
- Re: RFC 84 (v1) Replace => (stringi... Randal L. Schwartz
- Re: RFC 84 (v1) Replace => (stringifyin... Nick Ing-Simmons
