📘 The in and at methods in Perl 6 promises

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

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s