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 22:17
Subject:
Re: postfix dereference syntax
Message ID:
CAOeq1c8XD9CZpd97eMVRfhUikATQfMpz9vmdD=Cy8tCLFNq4Vg@mail.gmail.com
On Wed, Jul 3, 2013 at 5:51 PM, D Perrett <perrettdl@googlemail.com> wrote:
>
> object methods. Would we be better with a syntax for builtin methods?
>
>   $arrayRef->>flatten;
>   $hashRef->>flatten;

Rik said "no autoboxing" anyway, but just to complete the thought, I
think that "methods on references" and "methods on objects" could
coexist. If a programmer doesn't know whether they have a reference or
an object, it's up to them to sort it out.  Objects should be opaque.

Rather than ->> I'd prefer to just see it done with CORE, if that
could be made to work, so it's similar to ordinary superclass method
calling.

   $maybe_object->CORE::flatten;

If we had core classes for containers and if references were objects
this would all be a lot easier, but that ship has probably sailed.

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