I have a Perl 5 module called Every which provides, simply,

every(5); # true on invocation 5, 10, etc.
every(seconds => 5); # true at 5, 10, etc. seconds

It's really nice in endless loops, logging, etc.  I'd like to translate
it to Perl 6 (using Rakudo specifically).

Its current implementation requires Devel::Opcode because it needs to
know what location is getting called again and again.

Generally for Perl 6, is there a simple way to make Every obsolete by
using built-ins?  I'd love that but haven't seen anything in the
language that would help.  I want to avoid closures, they are expensive
(the current implementation uses one hash key per location).  Maybe I
could use a continuation (I don't know the syntax for that)?

Specifically for Rakudo, if I have to implement it, can I avoid
Devel::Opcode?  Are continuations expensive?

Thanks for any help
Ted

Reply via email to