# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #122504]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=122504 >


<moritz> m: -> $f, $s { return $f + $s }(23, 42)
<camelia> rakudo-moar 11afe1: ( no output )
<moritz> m: say -> $f, $s { return $f + $s }(23, 42)
<camelia> rakudo-moar 11afe1: ( no output )
<moritz> m: say (-> $f, $s { return $f + $s })(23, 42)
<camelia> rakudo-moar 11afe1: ( no output )
<moritz> ffs?
<moritz> m: say 23 + 42
<camelia> rakudo-moar 11afe1: OUTPUT«65␤»
<FROGGS> m: say( -> $f, $s { return $f + $s }(23, 42) )
<camelia> rakudo-moar 11afe1: ( no output )
<FROGGS> err
<moritz> oh
<FROGGS> a return in a pointy >.<
<moritz> return inside a lambda is a BAD IDEA
<moritz> return is only for routines
<moritz> it should say "return without a routine"
<FROGGS> if it does not do that it should state that the
return-exception missed its handler
<masak> m: return; say "alive"
<camelia> rakudo-moar 11afe1: ( no output )
<masak> I'd go so far as to consider that a bug.
<FROGGS> yeah
<masak> it can be caught *statically*.
<PerlJam> agreed
* masak submits rakuobug
<moritz> since control exceptions are lexotic, and all that
<masak> `return` in the mainline is always wrong.
<PerlJam> masak: sub MAIN { return 42; }   #   ;-)
<masak> PerlJam: that's un-wrong but meaningless :)
<PerlJam> masak: it's a gentle nudge toward improving the precision of
our words :)
<masak> PerlJam: I stand by what I said. MAIN is a sub, so `return` is
fine there.
<masak> PerlJam: it's only not fine outside of any routine.
<FROGGS> "Can only return from within a method or sub"
<masak> FROGGS: "routine"
<masak> that's the Perl 6 word for it.
<masak> FROGGS: you can return from a macro, too. for example.

Reply via email to