top | item 44014023

(no title)

pesnk | 9 months ago

Congratulations on the project! It works great, until we need to handle the best part of Elixir, that's creating multiple actors.

This Task code, for example doesn't work.

  Enum.map(0..10, fn(_) ->
    Task.async(fn -> IO.puts("new process") end)
  end) |> Task.await_many()

discuss

order

mathek|9 months ago

Tasks seem not to work indeed, but spawning processes works. Try

  Enum.map(1..10, fn _i ->
    spawn(fn -> IO.puts("new process") end)
  end)
Also, there are two scenarios: compiling code in the browser and running it, and running precompiled code in the browser. In the latter case more things work, for example the 'game of life' example uses GenServers, Supervisors and Registry:

https://popcorn.swmansion.com/game_of_life/

https://github.com/software-mansion/popcorn/tree/main/exampl...

But yes, it's still unstable. Improving the stability is our main focus right now.