I'm very new to the Perl 6 development process, and apart from browsing
through the RFCs and the archives of this mailing list, I haven't done
much research. So I apologise in advance if I'm breaking some etiquette/
convention by jumping in here with a half-baked idea!
Having said that: The only feature that I really miss from Perl 5 is the
lack of method pointers -- that is, references to functions in a package
with an associated object.
In straight Perl, the following works fine:
sub function { }
my $subref = \&function;
&$subref();
...however, the "natural" extension of this to a reference to a method
fails:
package Foo;
sub create { bless({},shift); }
sub method { }
package main;
$foo = Foo->create();
$methodref = \$foo->method;
&$methodref();
This can be "faked" at the moment by storing the object reference ($object
= $foo) and the CODE reference ($subref = \&Foo::method) separately, and
then constructing the method call:
&$subref($object, ...arguments...);
...but this breaks inheritance and all the other niceties of objects,
which are the main reason for using method references in the first place.
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?
Thanks for your time!
--
Ian Hickson )\ _. - ._.) fL
Netscape, Standards Compliance QA /. `- ' ( `--'
+1 650 937 6593 `- , ) - > ) \
irc.mozilla.org:Hixie _________________________ (.' \) (.' -' __________