On Fri, Nov 20, 2020 at 11:40 AM Larry Garfield <la...@garfieldtech.com>
wrote:

> > (5) function $lambda(... $args): returnType use ($captures...) {}
> >
> > To be honest, as I typed what came to mind, I ended up preferring this
> last
> > option.
>
> I kind of like that option, too.


Agreed that this has some attractiveness to it.

What does returning by reference look like in that world though?

$fn = function &$lambda($args...) {...};

Capturing lambda by reference doesn't make sense when you've just declared
the var, but it looks confusing AF.

$fn = function $lambda&($args...) {...};

Hello PERL...


>   The main question in my mind is whether that means the same variable is
> used internally and externally or not.
>

The prototype I wrote in my brain for this would have $lambda exclusively
within the closure's scope, not leaked to the declaring scope.  I think I
prefer that even though it looks a bit odd to have a name on a function
that's not accessible from where it's defined.

TL;DR - Still a little confusing.

-Sara

Reply via email to