📘 Channels in Perl 6

📘 Channels in Raku

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

Perl 6 includes a number of solutions for parallel and concurrent calculations. The great thing is that this is already built-in into the language and no external libraries are required.

The idea of the channels is simple. You create a channel through which you can read and write. It is a kind of a pipe that can also easily transfer Perl 6 objects. If you are familiar with channels in, for example, Go, you would find Perl 6’s channels easily to understand.

In this section, we discuss the simplest applications of channels, where things happen in the same thread. The big thing about channels is that they transparently do the right thing if you’re sending in one or more threads, and receiving in another one or more threads. No value will be received by more than one thread, and no value shall be lost because of race conditions when sending them from more than one thread.

Leave a Reply

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