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

Re: postfix dereference syntax

Thread Previous | Thread Next
From:
David Golden
Date:
July 3, 2013 08:39
Subject:
Re: postfix dereference syntax
Message ID:
CAOeq1c_DkpP=MXzCAXyWEpVhviTkx9zqseEwvUHEZ_y3pptsdw@mail.gmail.com
[Since insomnia is kicking my ass]

On Wed, Jul 3, 2013 at 2:02 AM, Kent Fredric <kentfredric@gmail.com> wrote:
> 1. If $foo is a bless, $foo->list would invoke (blessed $object)->list, not
> ARRAY->list , which meant you'd have to use a different syntax if you were
> inside a class definition.

Ugly option: do it with an upper case method, since those are
reserved.  But, frankly, I'd hate that, since my capslock is now a
control key and the uc typing overhead would annoy me more than
circumfix does.

> 2. ->@  could be imagined to be easily overloaded for, so bless()'d objects
> that *arent* arrays could still implement list deref overloads, so that
> they'd still work as arrays with things that need them to.

Assuming that it's implemented such that the resulting optree is an
ordinary array deref op, then the existing "@{}" overloading will
still work as it does now.

David

--
David Golden <xdg@xdg.me>
Take back your inbox! → http://www.bunchmail.com/
Twitter/IRC: @xdg

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