Karl Glazebrook wrote:
> 
> Ariel Scolnicov wrote:
> >
> > Karl Glazebrook <[EMAIL PROTECTED]> writes:
> >
> > [...]
> >
> > > o Why do I think perl has too much line noise? Because of code like this:
> > >
> > >   @{$x->{$$fred{Blah}}}[1..3]
> >
> > This is indeed horrible.  However, I fail to see how cutting out the
> > "line noise" would make it easier to decipher (I can, however, see how
> > splitting it into several expressions, possibly after signing travel
> > papers for the programmer, would improve it immeasurably).  Could you
> > post the proposed "new code", along with explanations of the proposed
> > syntax?

I propose EXPR->@ for @{EXPR}.

So that would be $x{ $fred->{Blah} }->@[1..3]

Note that $$fred{Blah} can currently be written as $fred->{Blah}, and
look a lot better IMHO.

Another example (since this is what I thought the above did at first):

@{$x->{${$fred{Blah}}}}[1..3]

(with spaces)

@{ $x->{ ${$fred{Blah}} } }[1..3]

becomes

$x->{ $fred{Blah}->$ }->@[1..3]

(without spaces)

$x->{$fred{Blah}->$}->@[1..3]

It's still not pretty, but at least you can read it left to right.

"Take x, dereference and look up something in its referenced hash. What
something? Well, lookup Blah in the %fred hash and dereference it to get
a scalar. Now take the result of that %$x lookup and grab elements 1..3
out of the array it references."

Reply via email to