4 ms·
It's not just context. It's also asynchronicity and error handling for example. The semicolon semantic is how operations separated by semicolons (or newlines)
by cube2222 4y ago
It's not just context. It's also asynchronicity and error handling for example.
The semicolon semantic is how operations separated by semicolons (or newlines) are evaluated and how they impact the general state the program is in. Which is also what a monad's flatMap does, in a configurable way.
- valenterry 4y agoNo, it is just context. Which context you choose in which part of your code is up to you. Somewhere I might choose ZIO. Elsewhere I might just choose an error-context. Or a state-context. Or a "let me accumulate some extra information while doing data-rprcessing"-context. And it is always explicit when you are in a context and which one it is. This is really the strengths over languages where this concept is missing. Those languages will just merge and mushup contexts and you never know exactly which things are safe to use and not.
- cube2222 4y agoI know you can do it, the question is whether it's mainstream to do it, or whether in practice you end up with a single one in 95% of the cases. Based on using it a bit and talking to many, more or less disillusioned, scala developers, my opinion is: it's not worth it. It's fine for us to disagree though. There's enough programming languages and projects for everybody.
- valenterry 4y agoIt is very mainstream to do that. Show me a project that is not just a small playground that uses either ZIO or cats-effect and does NOT use another context such as Either/Try or Option or List, ...