5 ms·
Perhaps, one should borrow message-passing as a standard language idiom, actors and pattern matching on receive from Erlang, the way Akka did, instead of copyin
by dschiptsov 10y ago
Perhaps, one should borrow message-passing as a standard language idiom, actors and pattern matching on receive from Erlang, the way Akka did, instead of copying hat async/await ugly hacks.
Message passing as a core concept of a language is fundamental and necessary (given that interlop with ObjC is important), and having that and macros gives related control structures for free.
- knocte 10y agoI could maybe agree with you on the message-passing thing (was about to upvote you). But then you mentioned macros.
- coldtea 10y agoThe macros he mentioned is the same the Swift team mentions -- hygienic modern macros, not some C-like crude text replacement system.
- bsaul 10y agoMessage passing unfortunately means everything is copied rather than pointed at. Which, in the case of a smartphone is always the beginning of performance or memory related problems. I think rust approach of having strong guarantees over memory ownage, and thus being able to share memory in a safe way, is a better direction for swift.
- nielsbot 10y agodoesn't copy on write + "immutable" solve the copying problem?
- dschiptsov 10y agoMessage passing, it seems, is the basis for implementation of protocols, be it communication between objects in a hierarchy or between actors/processes in a system or nodes in a network. It is not coincidence that message passing is the core concept in the original OO paradigm and in design of fault-tolerant distributed systems. Cells do message passing too. I am not sure what is being copied here. Messages are just structured data (a molecule) in otherwise share-nothing architecture.
- coldtea 10y ago>It is not coincidence that message passing is the core concept in the original OO paradigm and in design of fault-tolerant distributed systems. Cells do message passing too. This is not about "fault-tolerant distributed systems" though, but for "performance-first" for very CPU and memory expensive programs (video and audio processing, number crunching, etc).
- dschiptsov 10y agoJoe Armstrong thinks it is.
- coldtea 10y agoI doubt Joe Armstrong said anywhere that message passing can be as fast as shared memory for those kinds of applications.
- dschiptsov 10y agoHe advocates "fail-fast" and "share-nothing" as fundamental principles - that's the point. With no sharing a failure of a single process affects no other, unlike threads with shared stack and state. For the same reasons Erlang is functional language with single bindings. Sharing of immutable data is OK, so message passing might be implemented using OS shared memory services.
- 10y ago