3 ms·
> Another issue would be a coherent concurrency system. Today we have a mix of gcd and actor system, declarative task, async await, etc which when put together
by slavapestov 3y ago
> Another issue would be a coherent concurrency system. Today we have a mix of gcd and actor system, declarative task, async await, etc which when put together makes me totally unable to understand what's going on in a real world program, unless you're doing like i do in my team : i specifically ban all modern concurrency apis in favor of the old ones.
There’s a layering:
- gcd is the lowest level
- async/await lets you write tasks with suspension points (they wait for events to happen); but an async function is still conceptually executed serially
- the Task API let’s you spin up async functions into various arrangements of parallel tasks and wait for those tasks to complete
- ‘async let’ is sugar for creating a Task to compute a single expression
- for async functions and Tasks to share data there is a Sendable model and various static isolation checks
- actors build on everything else; actors are classes whose state is completely isolated to the actor, and all method calls are posted on the actor’s executor
Memory-safe concurrency is hard. There’s a lot of ground to cover to replace the kind of things people do with shared state concurrency, and just actors alone are not enough.
> Compare that to go, where there's (at most) one satisfying way to design the problem in the typesystem. As a sideeffect people have to think more about the problem they're trying to solve, and how to simplify it to the maximum.
I like the aesthetics of small languages too, but I think Go picked the wrong small subset. It reminds me of Java in the 1.x days, for x <= 4, where the language had fundamental expressiveness constraints that created a huge amount of unavoidable boilerplate and type unsafety in even the most basic programming situations.
- bsaul 3y ago"... reminds me of java" i was having doubts before go introduced generics. But the fact that they managed to add it so perfectly while maintaining the unambiguous focus on simplicity and structs made me confident they've really nailed it. The only feature i don't get why they haven't added yet is proper enum to get some kind of ADT. It looks super orthogonal to the language and quite convenient. However at this point i fully trust their taste. If they think it's going to lead to catastrophic design decisions, i fully believe them.
- pjmlp 3y agoGo generics are far from perfect, and while they finally sort out a major paint point, they still leave some room for improvements.
- bsaul 3y agoThey do, but i'm super relieved they managed to add it to the language while not changing its focus and general feeling. It really feels like a refactoring tool rather than a new design tool : you still think mostly about functions and structs and don't get carried by "is x a kind of y" kinds of discussion.