Sorry. TTIAR = Two Terms In A Row.
It's always a syntax error in Perl6, unlike Perl 5. print, say, and sin as you've used them are not terms, actually. They're expressions which happen to be function calls. You're calling .WHAT on their return values. This is predictable going forward from TTIAR: print 5; is not a syntax error. Therefore either print or 5 is not a term. You can rest assured that 5 is just a term, so it must be print that isn't. The return value of print is True, which has the Bool type. The return value of say is also True, but I think there's some kind of special casing thing going on in the repl, where the return value of say is suppressed. There's no valid dispatch for sin() with no arguments, so that one gives you an error. If you want the "noun form" of these subs, prefix with &. &print.WHAT Multi() &say.WHAT Multi() &sin.WHAT Multi(). If you want the type object of their return values, you've already got them, again except for the weirdness with &say, which I think is a special case of the repl: it's not evaluating the return value of say. say.WHAT.say tells the story, even in the repl. But seriously, congrats on breaking .WHAT in 60 seconds flat ;) On Dec 27, 2010, at 06:49 PM, Daniel Carrera wrote: > 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.