An idea introduced by CLU, copied by Modula-2+, Modula-3, C++ and Java, and usually blammed on Java.
https://www.academia.edu/71720554/A_Modular_Verifiable_Excep...
Link that doesn't suck: https://dl.acm.org/doi/pdf/10.1145/3318.3320
Thanks, it was a bit hard to find one on the phone.
C++ had a dynamically typed variant that was useless and got deprecated (and eventually dropped) a few standards ago.
It was deprecated in C++11, and a removed in C++17, yet now they are discussing adding it back in a flavour similar to Swift, so apparently there is some value into it.
So here you go, http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p070...
As for being useless, well that is the usual argument from no exception, no RTTI folks, that would be better off using another language instead of messing up with C++'s design.
I'm very much in favour of statically checked exceptions (and noexcept is sorta-kinda like that). It is the old dynamically typed style which was little more than an assertion that wasn't very useful.
Haskell's system (with the io monad + do not all monads or in general) is extremely similar to async/await and most languages with co-routines can simulate do notation in Haskell pretty well syntactically.
The advantage of something like JavaScript's async/await over Haskell's "do" is the fact because async/await is more limited than `do` (or yield and coroutines in JS) it's a lot easier to create tooling for.
I would say it is a huge disadvantage -- do is just syntactic sugar for a monad expression of binds, which is a native part of the language, you can write a simple function to manipulate it however you like. While you would need to effectively parse AST in case of JS.
`yield` is just syntactic sugar for the two-way generator communication protocol where the consumer calls `.next(value)` which returns a value in turn. This is as expressive and you can build `do` semantics on top of stuff like lists/either/state/io on top of it. No AST parsing needed.
And do syntax sugar is just nested calls of `bind` which is a function of the Monad trait. Lists are also a Monad, so do notation just works right now with lists, either, state everything in Haskell.
I really don’t get how is Haskell “behind”.
Re:I Believe Zig Has Function Colors
by ImprobableTruth on Saturday April 09, 2022 @06:06AM
(#30966653)
> async/await is more limited than `do` (or yield and coroutines in JS) it's a lot easier to create tooling for.
What kind of tooling are you referring to?
Basically by limiting the scope significantly and limiting it to language-level Promises you can create things like zero-cost async stack traces, async-call aware flame graphs and more for analysis and better lint rules and more specific types for development.
There’s also Haskell’s system, which IIRC uses an IO monad.