develooper Front page | perl.perl6.language | Postings from April 2008

use of ::?CLASS

Thread Next
From:
John M. Dlugosz
Date:
April 17, 2008 23:22
Subject:
use of ::?CLASS
OK, what is the proper use of ::?CLASS ?  Say in a role you want to take an argument of the same class as the final class, or explicitly declare $self.  S12 gives an example:

 method doit (::?CLASS $self: $a, $b, $c) { ... }

but this CONTRADICTS the idea that using the :: sigil in a declaration declares a generic type.  And you can't spell ?CLASS without the sigil because you never have a twigil without a sigil and ?CLASS is not a legal identifier.

The example of

    my @candidates := $object.WALK(:name<foo>, :breadth, :omit($?CLASS));

doesn't shed any light.  The meaning of $?CLASS is never explained.  Just a cryptic line in S02 "what class am I in (as variable)".  Is the same Type object accessible as the value of the item with the $ sigil?  Why is this necessary?  I wonder if it has something to do with problems using the :: sigil that I'm musing with.

--John

Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About