TSa (Thomas Sandlaß) thomas-at-sandlass.de |Perl 6| wrote:
a() proceed: orelse b();
... # make $! into return value
This kind of needs to know the variable the return value of a()
is stored into. This is easy if orelse is checking $! anyway.
But does it? And is it possible to have labels in the middle
of a line as above?
No, I think code in the CATCH could look at its context/callers and
issue a return from the proper one, that is the call to a().
In particular, it can be done using only the conceptual primitives.
Adding an easy way is just library code, not more primitive concepts
that need to be supported.
In particular, I'd like to have an easy way to get that particularly
interesting context (a special word used for the smart match syntax in
the existing context/caller mechanism) and a fail-as-return method on $!
that encapsulates all that, but always works right and efficiently even
in the face of optimization.