Nimony

The road to Nim 3

channels

nimony/lib/std/channels.nim

Typed channels (nim-lang/nimony#2635): copyable Sender[T]/Receiver[T] ends, over an in-process ring (channel[T]) or over any std/streamio stream (sender[T], receiver[T]). Waiting parks the task, it does not block a thread.

.. code-block:: nim let (r, s) = channelJob submit(delay(worker(r))) discard s.send Job(id: 1)

A Sender[T] and a Receiver[T] are copyable; all copies share ONE end, a Writer or Reader, so a stream never has more than one of each and its lifecycle stays that of a connection: the last copy gone is the end gone.