On Tue, Dec 28, 2010 at 1:21 AM, Mason Kramer <mason.kra...@gmail.com>wrote:

> 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:
>


Hmm... I think this will only make sense to me if I ask you to define what a
"term" is, but I am sure that this term (pun intended) is difficult to
define. In particular, if a number like 5 is a term, then I would think that
the following expression contains four terms:

2 > 3 ?? 5 !! 6

I figure that 2, 3, 5 and 6 are all terms. Or how about:

print 5 if 4;

I'd think that if 5 is a term, then so is 4.



> 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.

Indeed, it is. Strange. I would have thought that print, with no arguments,
would give me an error like with "sin". And why does "print" return True?
What's "True" about it?


> If you want the "noun form" of these subs, prefix with &.
> &print.WHAT
> Multi()
>
> &say.WHAT
> Multi()
>
> &sin.WHAT
> Multi().

Interesting. I imagine that Multi() means that the function has multiple
definitions. For example, I expect that "sin" has one implementation for
floats and another for complex numbers.

> But seriously, congrats on breaking .WHAT in 60 seconds flat ;)

:-)

Thanks for helping me learn Perl 6. It's a very neat language.

Daniel.
-- 
No trees were destroyed in the generation of this email, but a large number
of electrons were severely inconvenienced.

Reply via email to