4 ms·
I wish swift were like Scala. It attempts to look and feel like it, but there’s one huge aspect of Scala that is missing in swift that basically makes swift a w
by asimpletune 6y ago
I wish swift were like Scala. It attempts to look and feel like it, but there’s one huge aspect of Scala that is missing in swift that basically makes swift a world apart, which is expressions vs statements.
In Scala everything is an expression, meaning everything evaluates to some result even if that result is void.
In swift everything is a statement. There’s a big difference because statements don’t return things, only functions do.
It sounds minor, especially since swift has pattern matching and first class supper for functions etc, but the truth is these are all improvements over a more oop (in the Java sense) way of programming. They don’t however make the languages very similar because at a more basic so level they’re very different.
I would even go as far as to say that rust is more like Scala than swift is, although it’s been a while since I coded in rust.
- ebruchez 6y ago> In swift everything is a statement. There’s a big difference because statements don’t return things, only functions do. That sounds absolutely awful.
- asimpletune 6y agoIt’s such a small, non-flashy language feature, that honestly matters much more than almost everything else.