Najova

DocsGuides

Najoutines Planned

Najoutines are Najova's light tasks: many jobs running side by side, each one tiny, with no threads to manage.

Coming in Najova 1.0. This page shows the plan. Names may still change, and the example doesn't run yet.
$-- Load three pages at the same time, then use all three
$najoutines
  $let[news;$spawn[load;news]]
  $let[scores;$spawn[load;scores]]
  $let[weather;$spawn[load;weather]]
$endnajoutines
$print[$await[$get[news]]]

What you'll be able to do

  • Start a Najoutine anywhere with $spawn, and get its result with $await.
  • Pass values between Najoutines with channels: $send, $receive and $select.
  • Wrap Najoutines in an optional $najoutines block. The script only goes on once all of them have finished.
  • Stop a Najoutine, and every Najoutine it started stops too.
  • Catch a Najoutine's mistake where you $await it, with $try. The message keeps the file and line it came from.