2 ms·
I'd say this is largely a non-problem. If you already know F#, then Scala is a much simpler, more consistent language. In a way, Scala seems to be a refined, be
by happy_dino 14y ago
I'd say this is largely a non-problem. If you already know F#, then Scala is a much simpler, more consistent language.
In a way, Scala seems to be a refined, better designed version of F#.
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!
- PySlice 14y ago> If you already know F#, then Scala is a much simpler Well, F# does seem to have a lot of "bolted-on" features, but Scala always gives the impression that things "come out of nowhere", e.g. a simple underscore turns the whole expression into a lambda! It looks neat, but I will need some practice to get used to things like this. But, as I said, this is just a superficial analysis, some thing we can only learn after some practicing. > 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!