Re: [QUIZ] Perl 'What does this code do?' Quiz

"Rob Kinyon" <[email protected]> Mon, 2 Jul 2007 00:10:31 -0400
Newsgroups gmane.comp.lang.perl.qotw.discuss
Message-ID <[email protected]>
On 7/1/07, Greg Matheson <[email protected]> wrote:
> On Sun, 01 Jul 2007, Shlomi Fish wrote:
>
> > On Wednesday 27 June 2007, Rob Kinyon wrote:
>
> > > Nice. An mostly complete implementation of XBMLNFUI*  in P5.
>
> > What is XBMLNFUI?
>
> > I don't get it.
>
> > > * 13x simpler than rot13 ...
>
> Is this the answer?
>
>   DB<54> use Crypt::Rot13
>
>   DB<55>  $c = Crypt::Rot13->new
>
>   DB<56> $c->charge('xbmlnfui')
>
>   DB<57> x $c->rot13(25)
> 0  'walkmeth'
>
> But I don't know what 'walkmeth' is.

WALKMETH is a P6 thing (described in Apocalypse 12
http://dev.perl.org/perl6/doc/design/apo/A12.html) that generates a
list of all methods that will respond to that invocation. My answer
wasn't quite correct - the implementation of CALLALL described in A12
is the closer analog to the code provided.

The "mostly complete" bit had to do with a few missing paranoia bits
in the P5 as well as the fact that CALLALL does a take as opposed to
executing the method right away (lazy vs. immediate). Personally, I
prefer lazy evaluation as the default, but that's not really possible
in P5 without breaking encapsulation or doing crazy things like
Contextual::Return and the like that completely blow your runtime
performance.

Rob