New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.map as return value of sunk Promise doesn't get sunk #6307
Comments
From @zoffixznetNormally, if you sink a .map, it gets eagerly evaluated: <Zoffix__> m: <a b c>.map: &say However, this doesn't happen when the map is the last value of <Zoffix__> m: start { <a b c>.map: &say }; sleep 2; Workarounds: <Zoffix__> m: start { @ = <a b c>.map: &say }; sleep 2; |
From @jnthnOn Fri, 02 Jun 2017 15:43:07 -0700, cpan@zoffix.com wrote:
The last statement of a start block is not in sink context, because it becomes the result of the Promise. Sinking a Promise doesn't do anything (and certainly does not block on the result so it can sink it). You should always `await` or `whenever` a Promise or otherwise use its result (`.then(...)` for example), otherwise errors are also lost. So, this works as designed, and the program is at fault for not using the result of the Promise. Maybe some future Perl 6 version will handle start blocks in sink context differently (for example, giving them an error handling that brings down the program), but that's speculative at this point and we certainly can't do it without causing regression in 6.c. |
The RT System itself - Status changed from 'new' to 'open' |
@jnthn - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#131488 (status was 'rejected')
Searchable as RT131488$
The text was updated successfully, but these errors were encountered: