๐Ÿ“˜ The in and at methods in Perl 6 promises

๐Ÿ“˜ The in and at methods in Raku promises

N. B. Perl 6 has been renamed to Raku. Click to read more.


The other two factory methods, Promise.in and Promise.at, create a promise, which will be kept after a given number of seconds or by a given time. For example:

my $p = Promise.in(3); 

for 1..5 {
ย ย ย  say $p.status;
ย ย ย  sleep 1;
}

The programme prints the following lines.

Planned 
Planned 
Planned 
Kept 
Kept 

That means that the promise was kept after three seconds.

Leave a Reply

Your email address will not be published. Required fields are marked *

Retype the CAPTCHA code from the image
Change the CAPTCHA codeSpeak the CAPTCHA code