develooper Front page | perl.perl5.porters | Postings from August 2013

Re: postfix dereference syntax

Thread Previous | Thread Next
From:
Brad Baxter
Date:
August 17, 2013 01:23
Subject:
Re: postfix dereference syntax
Message ID:
CANBtU9bJOrhNS2dAb=AtS5uqEs=AVmzHt6xm+XWZiZ+A6TonJw@mail.gmail.com
On Thu, Aug 15, 2013 at 12:12 PM, Darin McBride <dmcbride@cpan.org> wrote:

> On Wednesday August 14 2013 4:44:31 PM Brad Baxter wrote:
>
> > FWIW, I would never use (this incarnation of) postfix dereference.  I'm
> > sorry, but to my eye $foo->@* is not prettier than @{$foo}.  And I
> > understand the latter.
> >
> > That is to say, with the latter, I know exactly where the entity being
> > dereferenced begins and ends.  With the former--phew--you got me.
>
> I think this says more about your comfort level than the usefulness, or
> lack
> thereof, of this functionality.  I know a lot of people who would never use
> perl 5 syntax because it's no prettier to them than perl 4 syntax, and they
> understand the latter.
>
> To me, the proposed new syntax will take a bit of learning, but will be
> hugely
> beneficial and make my code both easier to write as well as clearer in
> meaning
> as the flow will be more natural.
>

​Yes, positively, I'm more comfortable with​ @{$foo}, and the longer the
"$foo" part is, the more comfortable I am.

I'm also more comfortable knowing at the start what sort of animal I'm
expecting when all the dust settles.

I does mean I'll need to learn it, so I'll know it when I see it.  The
first thing I'll do when I see

​
$foo->{bar}->baz(27, flurg => gnar_now())->[4]->@*

is mentally turn it into

@{​
$foo->{bar}->baz(27, flurg => gnar_now())->[4]}

Well maybe not the first thing.  :-)

I do wish we could do without the trailing asterisk, but I appreciate that
the choices are limited.  I wish these worked

->[]
->{}
->$

but obviously, wishing won't make it so.

Brad

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About