Daniel, in rakudobug ticket [perl #61126] (>):
> The following two snippets of code are supposed to behave the same:
>
> sub bar($code) { $code() };
> sub foo { bar { return 1 }; return 2; }; say foo;
>
> and
>
> sub foo { map { return 1 }, 1; return 2 }; say foo;
>
> both are supposed to return "1".
>
> For some reason, map is being handled specially, while it is supposed to
> be dispatched as any regular sub.

The above reasoning raises the following question for me: how do I
return from a sub or a method from within a map block?

(Let's say, for the sake of discussion, that there is a legitimate
reason to do this. I know that "use a for loop if you want that kind
of side effect" is a reasonable purist answer.)

// Carl

Reply via email to