develooper Front page | perl.perl5.porters | Postings from January 2011

Re: Proposal: "$->" for implicit invocant

Thread Previous | Thread Next
David Golden
January 16, 2011 16:12
Re: Proposal: "$->" for implicit invocant
Message ID:
On Sun, Jan 16, 2011 at 2:06 AM, Chia-liang Kao <> wrote:
> "use feature 'invocant'" enables the $-> operator.  There are two
> variants:

If we're really pondering this sort of thing, why not think more
broadly and finally get around to dealing with method/object syntax?
(Like some of the syntax manglers on CPAN do.)


    use feature 'method';

    method foo {
        self->wibble($_) for @_;

I.e. Given a "method" keyword, set up the invocant in some way and
leave it out of @_.  People can bikeshed the most efficient way to set
up the invocant -- in my example I have a bareword, but it could be
"$self" or "$*" (available now without a deprecation cycle) or
whatever else people dream up.

-- David

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About