On Fri, Sep 14, 2018 at 4:16 PM ToddAndMargo <toddandma...@zoho.com
<mailto:toddandma...@zoho.com>> wrote:
On 09/14/2018 12:27 PM, ToddAndMargo wrote:
> Hi All,
>
> I use `->` all the time. What is its official name?
>
> for @x.kv -> $I, $Line {...}
>
> Many thanks,
> -T
Me thinks I am pushing "pointy" here!
#!/usr/bin/env perl6
sub Stooges() { return ( "Larry", "Curley", "Moe" ); }
my $x; my $y; my $z;
# ($x, $y, $z ) = Stooges;
Stooges -> $x, $y, $z;
say "$x $y $z";
$ Lambda.Test.pl6
===SORRY!=== Error while compiling /home/linuxutil/./Lambda.Test.pl6
Invalid typename 'say' in parameter declaration.
at /home/linuxutil/./Lambda.Test.pl6:10
------> say⏏ "$x $y $z";
Am I missing something here, or did I just get a little
too creative for my own good?
Many thanks,
-T
On 09/14/2018 01:23 PM, Brandon Allbery wrote:
It's still reading the block signature (parameters and return type) that
it expects after the ->, until it sees the start of the block/closure.
Think of what follows it as a sub declaration without the sub name or
parentheses. A semicolon there says that what follows are optional
parameters, so it's expecting either a parameter name, or a type to give
to the following parameter name.
So it needs a {} to work with. Rats!
Thank you!