3 ms·
Not a scala programmer, but I searched for "scala cheatsheet" and got the answer: https://docs.scala-lang.org/cheatsheets/ https://docs.scala-lang.org/cheatshe
by javajosh 5y ago
Not a scala programmer, but I searched for "scala cheatsheet" and got the answer:
https://docs.scala-lang.org/cheatsheets/ https://docs.scala-lang.org/cheatsheets/
Double arrow seems to have multiple uses - for anonymous functions (like in js) and for pass-by-reference arguments (I guess scala is pass-by-value by default).
(Surprised at how Erlang-y it feels, especially WRT pattern matching)
- nradov 5y agoSure but the issue is that when a single symbol has multiple meanings that presents an obstacle to learning the language and understanding a code base.
- javajosh 5y agoHow do you feel about = (assignment and equality check)? Or > which can be used for markup or less than or part of a function arrow? Or {} which can be used as a block or as an object? Or : which can be used for...so many things! Even the humble . can be used to dereference or as a decimal point. My point is that if "a symbol having multiple meanings" is a problem, then basically all languages have a problem.
- nradov 5y agoWell Java isn't too bad in that regard. It uses = for assignment and == for equality.
- dboreham 5y agoObviously that's a bad idea, which is why many languages don't overload = with two purposes. {} always means "group of related stuff" : always means : (sic) separator between a thing and something about the thing.
- dboreham 5y agoAs noted in the parent, I read the cheat sheet. It doesn't cover the use case for => I was trying to understand. The best (but still not exhaustive) doc is : https://stackoverflow.com/questions/7888944/what-do-all-of-scalas-symbolic-operators-mean https://stackoverflow.com/questions/7888944/what-do-all-of-s...