Andy Wardley wrote: > > Dan Sugalski wrote much sense, including these gems: [snip] > > Code must be able to fetch a handle on a particular method for later > > calling > > By this I presume you mean that the handle would be frozen to the > method as it was when then handle was fetched? If you later re-define > the method, the handle would remain pointing at the original method, > not the new one. > > Or not?
Redefining methods is almost (but not quite) as evil as altering inheritance trees (at least wrt to it's effect on caching methods). Consider the following perl5 code: { package MyClass; sub SomeMethod { 12 } } my $methodref = MyClass->can("SomeMethod"); *MyClass::SomeMethod = sub { return 42 }; print MyClass->SomeMethod(), "\n"; print MyClass->$methodref(), "\n"; I suppose if perl6's equivilant of 'can' returns a string, such as "MyClass::SomeMethod", then it might work as you want it to... but that would produce one extra level of indirection; would it be worth it? -- $;=qq qJ,krleahciPhueerarsintoitq;sub __{0 && my$__;s ee substr$;,$,&&++$__%$,--,1,qq;;;ee; $__>2&&&__}$,=22+$;=~y yiy y;__ while$;;print