Front page | perl.perl6.language |
Postings from April 2005
Re: calls and parens
Thread Previous
From:
Luke Palmer
Date:
April 25, 2005 13:26
Subject:
Re: calls and parens
Message ID:
20050425184035.GB14295@navi.cx
Juerd writes:
> Which assumptions are wrong?
>
> foo (3) + 4; # foo(7)
> foo(3) + 4; # foo(3)
> foo.(3) + 4; # foo(3)
> foo .(3) + 4; # foo(3)
>
> $foo (3) + 4; # syntax error
> $foo(3) + 4; # $foo(3)
> $foo.(3) + 4; # $foo(3)
> $foo .(3) + 4; # $foo(3)
>
> $o.m (3) + 4; # syntax error
> $o.m(3) + 4; # m(3)
none(@above)
> What do these mean?
>
> $o.m .(foo) # m(foo) or m().(foo) ???
> $o.m.(foo) # m(foo) or m().(foo) ???
>
> In the case of m(foo), m().(foo) is the obvious way to call the returned
> sub.
>
> In the case of m().(foo), I would not have any idea how to put
> whitespace in between method and opening paren.
>
> This leads me to believe that $o.m.(foo) and $o.m .(foo) are $o.m(foo).
Yep.
> Parens cannot be used to group an expression which is then
> used as a method name:
>
> $o.("on_" ~ %methods{$event}).(); # $o(...)
Well, you can't do that anyway. It has to be:
$o.::("on_" ~ %methods{$event}).()
Which I believe does the right thing anyway.
Luke
Thread Previous