http://www.perlmonks.org?node_id=468149


in reply to Re: Perl can do it, take 1 (sentence generation)
in thread Perl can do it, take 1 (sentence generation)

Can you please explain what .does(List) means ? I understand intuitively that it asks whether $phrase is a list, but how does it work, exactly ?

Replies are listed 'Best First'.
Re^3: Perl can do it, take 1 (sentence generation)
by eric256 (Parson) on Jun 19, 2005 at 18:25 UTC

    As far as I know that is all there is to tell. ;) The . by itself acts on the topic ($_) So that is the same as $_.does(List). My understanding is that does is checking the roles of the object it is called on. Evnetualy (when pugs gets more mature) we will be able to do. when List {} and it will DWIM, hopefully. BTW the given $phrase makes $phrase the current topic.


    ___________
    Eric Hodges
      OK, thanks - I figured most of it out after posting by reading the apocalypse / exegesis on objects.

      Frankly, the syntax .does(List) doesn't feel good to me, so I'm glad you're saying we'll eventually be able to just say when List. Is the latter legal Perl 6 and you didn't use it just because you wanted a working pugs-compilable code ?