Hacker News new | ask | show | jobs
by dom96 3102 days ago
Disclaimer: I'm a core Nim dev.

To be honest I am unsure what Pony provides that Nim doesn't. Perhaps I just haven't looked closely enough at it.

One thing I do know is that from my years of using Nim I never had any trouble with parallelism. There are no green threads, but there is a solid thread pool implementation[1] and a mechanism that ensures memory isn't shared between threads without a lock or a channel (GC safety)[2].

Maybe you could give me a TL;DR of what Pony does better? :)

1 - https://nim-lang.org/docs/threadpool.html

2 - https://nim-lang.org/docs/manual.html#threads-gc-safety

2 comments

Pony has an Actor as a language-level concept, which significantly reduces the amount of “thinking about mechanism” that a programmer needs to do to build safe, highly-concurrent programs.

Quick read: https://tutorial.ponylang.org/types/actors.html

I think one could implement a similar system in Nim using the primitives that you posted, plus some kind of channel, but:

1. Such a system is not included in the standard library (?)

2. Even if a package containing such a system outside the stdlib were available, it would not receive the same application and usage by the Nim community, as Pony actors will in the Pony community

3. So, Pony is better suited to foster a community for highly concurrent programming

Does an actor system need to be part of the language? In the Scala world, there's the akka library to provide actors (but of course you could use a totally different actor system instead). Alternatively in Elixir, actors (Processes) with their send/receive functionality is built into the language and each module can essentially be an actor.

I guess the trade off is that if it's a part of the language, you get it standard and built in as a language construct. But if it's in an external library, you can use different actor systems and benchmark them accordingly.

one benefit is that you can effectively embed the concept directly into the type system, allowing for ergonomic expression of actor model code. i'm not sure to what extent pony does this, though i believe it's capability typing was designed with actors in mind.
maybe the green thread thing doesn't bother you because you are a seasoned system dev?