Skip to content
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

phasers/loop controls in routines that accept Callables #6223

Open
p6rt opened this issue May 5, 2017 · 1 comment
Open

phasers/loop controls in routines that accept Callables #6223

p6rt opened this issue May 5, 2017 · 1 comment
Labels

Comments

@p6rt
Copy link

p6rt commented May 5, 2017

Migrated from rt.perl.org#131261 (status was 'new')

Searchable as RT131261$

@p6rt
Copy link
Author

p6rt commented May 5, 2017

From @zoffixznet

I came across an interesting doc Issue[^1] showcasing `next` working inside the Callable given to `Any.first`.

The reason it works is pure accident and other loop controls don't work, nor do the phasers.

`grep -FR 'Callable' src | wc -l` gives 128 matches, and I'd guess at least some of those are a similar
situation where loop controls/phasers either interfere with the internals in the method or are not handled.
For example, some phasers are currently not handled[^2] by .grep method.

So the question is, what do we do about these?

Implementing handlers for everything would be giant buggy mess and pessimization, often done to handle cases
no one really needs. Catching stuff in CONTROL just to throw is also messy and may interfere with stuff
that does want to propagate those exceptions further up the food chain.

Or lastly, and this is the option I favour, don't do anything. We implement handlers for controls/phasers
only where they make a lot of sense and document the places where they work. In all the other cases, were
a Callable is taken by routines, we simple declare that control exceptions/phasers are undefined behaviour
and should not be used. IMO the latter category includes the grep[^2] phasers as well; if someone really needs
to phaserize a grep callable, rewrite it as a for/gather/take thing.

[1] Raku/doc#1290
[2] https://rt-archive.perl.org/perl6/Ticket/Display.html?id=131060

@p6rt p6rt added the at_larry label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant