chromatic skribis 2005-06-20 14:56 (-0700): > Who says AUTOLOAD will always either call a loaded sub or fail?
I don't recall any clearl spec of Perl 6's AUTOLOAD. If there is something I missed, say so and please do provide example code. Questions like the one quoted tend to irritate me. There is almost always either success or failure. Programming would get very hard if it weren't as black and white as that, at this level. If there is anything in between success and failure, indicating success is probably still the better idea in such cases. Returning a closure avoids having to lookup the sub again before it is executed, and it allows for not installing the sub, so that AUTOLOAD is called again, the next time the same name is used. It also allows doing nothing: just return sub { }. I don't think there is anything that this setup cannot do, but I do think this way is necessary. Because context is dictated by signature, and signature may not be known for a not-yet loaded sub, AUTOLOAD has to be called before the arguments are evaluated. Because they're not evaluated, they cannot be passed, and they cannot be used by AUTOLOAD to be fed to the (supposedly) newly loaded sub. Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html http://convolution.nl/gajigu_juerd_n.html