4 ms·
"better-than-Rust safe memory sharing" lol it's just garbage collection
by floatboth 9y ago
"better-than-Rust safe memory sharing" lol it's just garbage collection
- TokenDiversity 9y agolol really? haha, nice bait. I have to go read it now.
- stewbrew 9y agoA GC doesn't make data sharing in multithreaded applications safe.
- dozzie 9y agoOnce you have "Erlang-like actors", you don't have data sharing.
- vanderZwan 9y agoYou do in Pony. One point of the type system is to allow safe passing of data between actors without copying everything.
- dozzie 9y agoThen you don't have "Erlang-like actors", which is an implementation of CSP (unintended, designed separately, but still). Unless you mean that some data is shared, but cannot be modified, but this would be semantically identical to not sharing anything.
- vanderZwan 9y agoShared immutable data is one option, but what I also mean is that when the type system can guarantee at compile time that the actor sending the data does not have read- or write- access to the data after sending, the system knows it can just "recycle" the old data, without run-time overhead. Look, just read up on the type system, specifically reference capabilities[0]. It's basically what allows for safe mutability and data passing when required. [0] https://tutorial.ponylang.org/capabilities/reference-capabilities.html https://tutorial.ponylang.org/capabilities/reference-capabil...
- Eerie 9y ago>Unless you mean that some data is shared, but cannot be modified, but this would be semantically identical to not sharing anything. That's the gist of Rust's borrow checker. Shared data can't be modified (unless you use a Mutex or something similar, but then you need to acquire a lock, so data you can mutate is not shared).
- bascule 9y agoErlang puts all binary data on a heap which is shared between actors
- dozzie 9y agoI said already: > [...] this would be semantically identical to not sharing anything. Erlang's data sharing (and no, not all binary data, just over a certain threshold; if you want to nitpick, be diligent and precise) is merely optimization trick, highly uninteresting when it comes to discussing type systems (because its semantics are identical to not sharing anything at all). BTW, if you talk about Erlang, use proper Erlang's terminology. Erlang doesn't have "actors", it has "processes".
- vanderZwan 9y agoYou really should do your homework better. Garbage collection says nothing about data races. Also, because of the compile-time memory safety inherent in the type system, they can build a much better garbage collector than whatever you are probably thinking of. http://www.doc.ic.ac.uk/~scd/icooolps15_GC.pdf http://www.doc.ic.ac.uk/~scd/icooolps15_GC.pdf
- pjmlp 9y agoFrom the naive clueless knowledge of GC implementation algorithms, yes. From the point of view of those that understand GC implementation algorithms, it is an actor local GC only executed at specific defined points, coupled with capabilities. Rust use of affine types for memory management is great, but not all applications need such tight memory management, so it is a good productivity improvement to just be able to use a GC approach.