develooper Front page | perl.perl6.language | Postings from March 2009

Re: r25807 - docs/Perl6/Spec

Thread Previous | Thread Next
From:
Jon Lang
Date:
March 12, 2009 18:33
Subject:
Re: r25807 - docs/Perl6/Spec
Message ID:
ef30550b0903121829i145bd7aex874e406105ed1d78@mail.gmail.com
> +To declare an item that is parsed as a simple term, you must use the
> +form C<< term:<foo> >>, or some other form of constant declaration such
> +as an enum declaration.  Such a term never looks for its arguments,
> +is never considered a list prefix operator, and may not work with
> +subsequent parentheses because it will be parsed as a function call
> +instead of the intended term.  (The function in question may or
> +may not exist.)  For example, C<rand> is a simple term in Perl 6
> +and does not allow parens, because there is no C<rand()> function
> +(though there's a C<$n.rand> method).

So if I were to say:

    rand $n:

is the compiler smart enough to notice that trailing colon and
recognize this as an indirect method call rather than two adjacent
terms?  Or would I have to say:

    rand($n:)

to get the indirect method call?

-- 
Jonathan "Dataweaver" Lang

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About