
Show HN: Pony Programming Workshop - aturley
https://github.com/aturley/pony-workshop
======
aturley
I'm giving a Pony workshop at ICFP this year
([https://icfp18.sigplan.org/event/icfp-2018-tutorials-
writing...](https://icfp18.sigplan.org/event/icfp-2018-tutorials-writing-a-
chat-system-in-pony)), this repo represents the material that I'll be
covering. I've given early versions of it twice in NYC. I think it kind of
works as a stand-alone thing (but you miss the thrill of hearing my voice and
asking questions).

I'd love to get some feedback if anybody has any thoughts.

~~~
spooneybarger
There's also a Pony workshop at CodeMesh in London this November for those who
can't make it to ICFP but can make it to London.

[https://codesync.global/conferences/code-
mesh-2018/training](https://codesync.global/conferences/code-
mesh-2018/training)

------
whitten
Could you shed some light on how you made the playground.ponylang.org website
work? Do you allow multiple actors to all be run at the same time? How do you
coordinate the various outputs of the various actors?

~~~
aturley
I didn't build the playground website so I can't comment too much on it, but I
can try to answer your question since I don't think it is specific to the
website (but if my answer doesn't help please let me know, I may have
misunderstood the question).

Actors in a Pony program all run within the same operating system process, so
in theory there shouldn't be a limit to how many are run. In practice each
actor takes up some memory so if you start enough of them you'll crash the
process when you run out of memory.

Pony has a scheduler that schedules actors to run on threads. By default a
Pony application starts with as many threads as there are CPUs in the system,
but that's adjustable so the playground may tune that down. So all the actors
are free to be available to be scheduled, but the number that are running at
the same time is dependent on how many threads the scheduler has, and how many
actors are processing messages at a given time.

Output in Pony is done via two actors: `env.out` is for stdout, `env.err` is
for stderr. If you want to print a string you send that string to the actor
via a `print(...)` message. Actors only process one message at a time, so each
string will be printed in the order in which the output actor received the
`print(...)` message.

Hopefully that helps a little. I'm happy to try to clarify or answer other
questions.

