Subject: | Consider an async {BLOCK} expression |
There's a growing number of cases in both unit tests and real code, of writing
$f = (async sub { ... })->();
This is often useful in e.g. cases involving Future->needs_any
Future->needs_any(
(async sub {
# Real code goes here involving await expressions
})->(),
$loop->timeout_future(after => 10)
);
These might look neater if there was some syntax sugar for doing that,
Future->needs_any(
async {
# Real code goes here involving await expressions
},
$loop->timeout_future(after => 10)
);
As an implementation it would probably just desugar into the same notation above, though it could also set the CvNAME of the otherwise-anon sub inside, so that caller/die/croak/etc... will look a little neater
--
Paul Evans