Maybe, at some point, if you have spare time, I recommend that you give a modern language like Scala, Haskell or ML/Ocaml/F# that don't distinguish statements from expressions a second chance.
Maybe, at some point, if you have spare time, I recommend that you give a modern language like Scala, Haskell or ML/Ocaml/F# that don't distinguish statements from expressions a second chance.
On the other hand, Scala gives me a completely different feeling: when reading the docs and samples, I often ask myself:
How can I mentally parse this?
It's nice that I can abbreviate some common constructs (when writing), but when reading code, how can I tell which concepts are being used? How do I look up these operators when they could come from anywhere (global, first operand, second operand, implicit conversion, etc.)
How do I know when parentheses, dots, curly braces, are mandatory or optional? Could the compiler misunderstand me in complex situations? Where does this construct really end if so many things are optional? At least F# uses indentation, so I know the compiler will warn me if I wrote something that is not quite right according to the precedence rules.
There are too many implicit things going on, how do I know which meaning of _ (underscore) is meant here?
For instance, F# has support for functional and object-oriented programming, but most people I spoke to recommend just ignoring the object parts. That's certainly my impression, too. Compared to Scala, F# didn't manage to combine FP and OOP into a single, coherent approach. You have more or less ML's type system with the object stuff bolted on.
Another example would be that F# has tons of features where a single one could suffice. Consider the Unit of Measurement stuff, the various forms of (computation) expressions and type providers. Scala can do all of that and a lot more with "just" macros.
> It's nice that I can abbreviate some common constructs
Not sure what you mean with that.
> How do I look up these operators when they could come from anywhere (global, first operand, second operand, implicit conversion, etc.)
Not really. There are no operators, everything is a method invocation. The method is either defined on the type of the left, or added by an conversion from that type. That's it.
> How do I know when parentheses, dots, curly braces, are mandatory or optional?
Method calls with one argument can leave out dot and parentheses. If a method has a side effect, you define and call it with parentheses, otherwise you leave them out.
> There are too many implicit things going on, how do I know which meaning of _ (underscore) is meant here?
People love to make up scary examples, but I have never seen any actual misuse of implicits in real code. The meaning of the underscore doesn't change, it is always the same: "There exists something, but I don't care to give it a name."
I hope that helps a bit!
> Not sure what you mean with that. Braces, parenthesis, dots, semicolons, and IIRC you can use the arrow => without anything on its left side.
> The method is either defined on the type of the left, or added by an conversion from that type. That's it.
Unless it ends with a colon, right?
> Method calls with one argument can leave out dot and parentheses
That's somewhat simpler than I expected. I thought it was something Perl-like or Ruby-like (where obj.method + 1 is different from obj.method +1). There should be some way to get a reference to a method without calling it, that I still haven't learnt.
> If a method has a side effect, you define and call it with parentheses, otherwise you leave them out
Not sure I understand this. Is this the preferred coding style or something enforced by the compiler?
> I hope that helps a bit! Yes, it helped! Thanks!
Deleted comment
Go is good because it's hard to write clever code in it. Go encourages simple code. Clever code is almost always bad. It's hard to understand and easy to screw up. For example, at work we had a bug in production for 5 years that short circuited our authorization code because of an incorrectly written ternary statement. If the author had written a simple if statement, the error would have been blindingly obvious. It should have been caught by tests, but due to how the tests were written, that particular path never got called.