Today, according to Seinfeld, is Festivus the Holiday for the rest of us. One of the rituals of Festivus is the Airing of Grievances. It consists of lashing out at others and the world about how one has been disappointed in the past year. In particular, let's lash out at Perl.
Here, I'll start.
Perl, I hate your dereferencing syntax so much.
push @{ $hash->{key} }, 42Oi what a mess! Why can't you just put autoboxing into the core?
$hash->{key}->push(42)Is that so hard? Your sister Ruby can do it, why do you have to be such a shlemiel?
I agree the deref syntax is yuk, but I don't know if autoboxing is the answer. I actually think the direction of the pipeline with autoboxing is weird, not to mention the whole "is it returning things or modifying in place" confusion (yes, yes, obviously people would figure that one out, but both options are totally legit, so it is not always obvious which one it should/would/could be). Overall I found autoboxin' to be kinda un-Perlish myself, I prefer to just meta-program all that yuk away instead.
- Stevan
Re:Autoboxing,.. eah
schwern on 2007-12-25T02:16:53
I'm sorry, this does not appear to be a Perl grievance.
I don’t see why we’re being forced to write the outer deref. It could be much simpler:
push $hash->{key}, 42;
Much nicer than autoboxing, too.
There’s never any more or less of a guarantee that $hash->{key}
will be an array-ref anyway, regardless of which way you write it. There's never any ambiguity there either. The current rule is just arbitrary outgrowth of the prototype brain damage. A better way to approach the problem that prototypes attack would have been to provide a prefix notation for binary operators and then declare push
et al an operator.
I had hoped that autoboxing would at least give me something close to that by means of indirect object syntax:
push $hash->{key} 42; # note the missing comma
However, no dice. I can find no way to convince Perl to parse something that starts out like a plain push
invocation as an indirect object method call instead. It always complains that something is wrong before it gets to the end of the expression.
Re:Eenhhhhh.
schwern on 2007-12-25T02:17:35
You were starting to get into the grievance thing at the end there.
Re:lemme see...
schwern on 2007-12-25T02:19:00
Jarkko's got the idea. More more!
Why is the only difference between methods and functions at the point of call, not the point of declaration?
Re:Ohhh! Don't get me started!
Adrian on 2007-12-27T02:23:58
Oh yeah. 1/3 is a bloody rational. Treat it like one until I tell you otherwise.Re:Ohhh! Don't get me started!
markjugg on 2007-12-27T03:34:00
* Packaging up a whole bunch of stuff for deployment by non-Perl gurus is just too damn hard
Amen.