On Tue, Dec 28, 2010 at 12:38 AM, Mason Kramer <mason.kra...@gmail.com>wrote:
> One method-like thing that's come in handy for me as I've tinkered with the > language is .WHAT. > > { ... }.WHAT > Block() > > AFAIK, you can use .WHAT on *any* term, because every term in Perl6 is an > object that is implemented by a class, and every class has a corresponding > type object (which is what .WHAT returns for you). > That's cool. Thanks. I notice it works on numbers and string literals: "hello".WHAT # Str() 3.WHAT # Int() 3.3.WHAT # Rat() pi.WHAT # Num() (1+3i).WHAT # Complex() But it seems to give very inconsistent results when applied to functions: print.WHAT # Bool() say.WHAT # [blank] sin.WHAT # [error] This might not have helped you had you not realized that {%matches{$p1}++} > is a term. However, if you keep in mind that TTIAR is always a syntax error > in Perl6, then if your code is compiling, whatever is between ?? and !! must > be a single term. > > It's really the TTIAR thing that makes reading Perl6 so incredibly > predictable, I think. > What is TTIAR? Daniel. -- No trees were destroyed in the generation of this email, but a large number of electrons were severely inconvenienced.