Re: calls and parens
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
calls and parens
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) 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). - Parens cannot be used to group an expression which is then used as a method name: $o.("on_" ~ %methods{$event}).(); # $o(...) Is there a way to do this without temporary variable? Juerd -- http://convolution.nl/maak_juerd_blij.html http://convolution.nl/make_juerd_happy.html http://convolution.nl/gajigu_juerd_n.html