> > One of my many RFCs will include a proposal for a $SELF variable along
> > those lines.
>
> Why not allow for the choice of the name of self, perhaps through a pragma?
>
> use self => 'self';
> use self => 'this';
>
> or something along those lines -- since it's currently up to the devleoper
> anyway. Somethign about a capitolized SELF is unappealing to my eyes.
$ME will be like other magic variables, so you can always write:
sub self {$ME}
sub this {$ME}
sub I {$ME}
sub one {$ME}
sub obj {$ME}
sub TheObjectThatThisMethodWasInvokedOn { $ME }
# and later
sub shout {
self->set_name(uc this->get_name);
}
Of course, these particular subroutines might be a good (and easy)
target for inlining optimization.
Damian
- Re: New Group proposed: subs (wa... Damian Conway
- Re: New Group proposed: subs... Hildo Biersma
- Re: New Group proposed: subs... Andy Wardley
- Re: New Group proposed: subs... Glenn Linderman
- Re: New Group proposed: subs... Tom Christiansen
- Re: New Group proposed: subs... J. David Blackstone
- Re: New Group proposed: subs... J. David Blackstone
- Re: New Group proposed: subs... Kyle R . Burton
- Re: New Group proposed: subs... Peter Scott
- Re: New Group proposed: subs... Johan Vromans
- Re: named parameters Damian Conway
- Re: named parameters Piers Cawley
- Re: named parameters Damian Conway
- Re: named parameters Tim Jenness
- Re: named parameters Damian Conway
- Re: named parameters Damian Conway
