|
|
|
|
|
by seertaak
1947 days ago
|
|
Sorry, not just a little weaker. A _lot_ weaker. It lacks union and intersection types, and to my mind this is kind of inexcusable in a modern language. I'm not even talking about pattern matching, union types are simply necessary in an expression oriented language. It's that simple. Then, intersection types are the dual of union types. (By the way, Rust lacks union types too, and it makes the language absolutely insufferable. Simply adding, say, a print statement as the last expression in one branch of an if statement changes that branches type, producing an error due to A/B type mismatches There is often no valid reason, e.g. in the case your branch isn't assigned to an expression. Even if it were, the type of that expression should be a union type: problem solved. It's so basic and so obvious, that Algol 68 got it right back in the 60s. Why on earth would you add discriminated unions but _not_ unions? It makes no sense.) (I'm going to go off on a second tangent now: can we please just dust off the cool ideas in that language, like references represented in the type system, rather than replicating C++'s god-awful value categories and even _more_ reference squiggles? Consider how C++'s awfully complex [] move semantics could be expressed in that language!]). [] https://www.reddit.com/r/cpp/comments/ll2azr/move_simply_sut... |
|