In the previous section, we were creating some code blocks that were running in parallel. Promises help to see the status of the completeness of such blocks. In Perl 6, promises are handled by the Promise class.
Promises
Creating a promise
To create a promise, just call the constructor of the Promise class:
my $promise = Promise.new();
The created object does nothing yet. In the Factory methods section later in this chapter, we will see how to create a promise that executes some code. Meanwhile, let's see the properties that a promise has.
Statuses of a promise
The...