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

Re: RFC from a newbie: Method References

Thread Previous | Thread Next
December 16, 2000 09:29
Re: RFC from a newbie: Method References
Message ID:
>>>>> "Ian" == Ian Hickson <> writes:

Ian> So: What I would love to see in Perl 6 is a way of having a single scalar
Ian> that holds a reference to a particular instance's method.

Ian> Is there any chance that this would be considered? Or is this already
Ian> possible in Perl 5 but I have missed it?

  my $methref = sub { $foo->method(@_) };

You missed it. :)  Just be sure that $foo is not a package variable,
so that a proper closure is created.

Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<> <URL:>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See for onsite and open-enrollment Perl training!

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