2 ms·
You're not "communicating by sharing memory" though, at least in the idiom's sense (in which "memory" is an alias for "mutable state"), the structural sharing i
by masklinn 9y ago
You're not "communicating by sharing memory" though, at least in the idiom's sense (in which "memory" is an alias for "mutable state"), the structural sharing is just an optimisation.
Which may not even be desirable: despite being built entirely upon immutable data structures, Erlang only share large binaries between processes (AFAIK even the new maps are copied despite being HAMT) to ensure process heaps and thus garbage collections are completely independent.
- amelius 9y ago> Erlang only shares large binaries between processes to ensure process heaps and thus garbage collections are completely independent. That sounds unnecessarily restrictive. At least they should give developers a choice (e.g., "this process should receive integral data, and should not be disturbed by a GC cycle of other processes"). Also, concurrent (not stop-the-world) GC techniques could make this problem moot.
- masklinn 9y ago> Also, concurrent (not stop-the-world) GC techniques could make this problem moot. It would mostly introduce insane additional complexity. Erlang GC works per-process (each process has its own private heap and stack) and you'd normally create lots of small processes, so the GC is concurrent as an emergent effect of the system construction. Not to mention processes can be distributed across nodes for which your scheme completely breaks down, what's supposed to happen if you ask for memory sharing across the network?
- amelius 9y ago> It would mostly introduce insane additional complexity. GoLang has a concurrent garbage collector. > what's supposed to happen if you ask for memory sharing across the network Yeap, I mentioned that. Again, as a developer you want the choice. You don't want your language telling you "sorry, that's too complicated for your brain, so you can't do that".
- masklinn 9y ago> GoLang has a concurrent garbage collector. Golang also has a single, shared, mutable heap, it does not have tens or hundreds of thousands of individual heaps. > Yeap, I mentioned that. No, you did not. > Again, as a developer you want the choice. Er… no?