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

Re: postfix dereference syntax

Thread Previous | Thread Next
Darin McBride
August 20, 2013 19:33
Re: postfix dereference syntax
Message ID:
On Tuesday August 20 2013 2:34:49 PM Eric Brine wrote:
> On Tue, Aug 20, 2013 at 1:38 PM, Zefram <> wrote:
> > Eric Brine wrote:
> > >$ can return a list of scalars in addition to a scalar.
> > 
> > I think you're getting confused about what the sigil applies to. $foo or
> > ${...} always represents a scalar, never a list.  In "$foo->bar", the $
> > sigil applies to the "$foo" part, and accurately indicates that it is
> > a scalar.  That the "bar" method can return a list doesn't invalidate
> > the consistency of the sigil's meaning.
> You seem to have missed the context. demerphq was saying $foo->@* returned
> a list instead of a scalar, breaking the pattern. He was clearly looking
> past the "->".

He was complaining that it shouldn't because he didn't want to look past the 

I had pointed out that methods already break this.  Eric pointed out more ways 
that the initial sigil doesn't quite always match up with what is returned.

Basically, we already have to watch both ends of an expression with arrows to 
figure out what it's going to do, so I like this postfix derefence syntax 
because it flows more naturally for me.
Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About