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

Re: postfix dereference syntax

Thread Previous | Thread Next
From:
Aaron Priven
Date:
August 15, 2013 18:35
Subject:
Re: postfix dereference syntax
Message ID:
566C7413-724C-4EBC-82DA-889B0F7D8736@priven.com

On Aug 15, 2013, at 11:19 AM, Ricardo Signes <perl.p5p@rjbs.manxome.org> wrote:
> So: ->[] means "the array"
> But ->[1,2,3] means "the slice" (a list)
> And so ->[()] means "the slice of no elements (an empty list)
> 
> It's bound to cause painful confusion.


On Aug 15, 2013, at 11:31 AM, Ricardo Signes <perl.p5p@rjbs.manxome.org> wrote:
> Also, that's plausible for array references.  What about scalar references?
> 

The part I don't get is why it's necessary to specify the type of dereferencing. 

I'm not seriously suggesting using this character, but suppose you had

$foo->®

(that's the registered trademark symbol)

Then whatever you had in $foo, it could be dereferenced, into whatever it is -- scalar, hash, array, glob, etc. There's no ambiguity there, is there?

-- 
Aaron Priven, aaron@priven.com, www.priven.com/aaron


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