Autrijus Tang wrote:
The compiler, in turn inspect whether there's an bound $_ in scope
with $?SELF set.  It is not trivial, because this should work:

    sub baz (&c) { c() }
    method foo { baz { .bar } }     # $_ is free in inner closure

But this needs to fail:

    sub baz (&c) { c(1) }
    method foo { baz { .bar } }     # $_ is bound in inner closure

I might still not understand topic, $_ or lexical vars in general.
But why does the fact that &c is called with a parameter
in the second case and without one in the first example make a
difference? Isn't $_ always coming in out of band? So .bar is always
invoked on the invocant of &foo if we think that there is an implicit
$_ := $?SELF before the call to &baz in &foo.  And I hope the binding
of $_ to $?SELF is a read-only binding!
TSa (Thomas Sandlaß)

Reply via email to