develooper Front page | perl.perl6.language.objects | Postings from December 2000

Re: RFC from a newbie: Method References

Thread Previous
From:
Ian Hickson
Date:
December 16, 2000 00:59
Subject:
Re: RFC from a newbie: Method References
Message ID:
Pine.WNT.4.21.0012160101190.936-100000@HIXIE.netscape.com
On Fri, 15 Dec 2000, Michael Fowler wrote:

> On Fri, Dec 15, 2000 at 11:23:23PM -0800, Ian Hickson wrote:
> > So: What I would love to see in Perl 6 is a way of having a single scalar
> > that holds a reference to a particular instance's method.
> > 
> > Is there any chance that this would be considered? Or is this already
> > possible in Perl 5 but I have missed it?
> 
> How about:
>     my $foo = Foo->create();
>     my $methodref = sub { $foo->method(@_) };
> 
>     &$methodref();
> 

Oooooh!

Dude.

I am not worthy.

Thanks!!!!!

-- 
Ian Hickson                                     )\     _. - ._.)       fL
Netscape, Standards Compliance QA              /. `- '  (  `--'
+1 650 937 6593                                `- , ) -  > ) \
irc.mozilla.org:Hixie _________________________  (.' \) (.' -' __________


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About