If I follow what you're saying (and this is by no means a certainty :)
I would tend to look more for a declarative solution than a callback
solution, so I'm imagining that any closure could have a declarator
that explicitly captures an outside lexical and makes it available
as an attribute.  I don't quite want to use "has" though, but it
something possessive.

    my $x = 42;
    &f := sub {
        have $.x;
        say $x;
        ...
    }
    say &f.x;

Here I'm using the plural possesive to indicate that $x is shared, in
the same sense that "our" is indicating something that's shared, only
in this case it's a shared lexical rather than a shared package variable.

Then you'd just use some variant of ordinary introspection to find
these methods.

But I've probably missed your meta-point entirely...

Larry

Reply via email to