3 ms·
As someone who has seen scala, but never really wrote anything in it, what in heaven's name does that statement do?
by zipperhead 15y ago
As someone who has seen scala, but never really wrote anything in it, what in heaven's name does that statement do?
- jorgeortiz85 15y agoIt does whatever you want it to do. ~->, <~<, and %% are just method names. It parses like: val foo = bar.~->(45).<~<("Fred").%%(x) If those same methods were called a, b, and c instead, it would parse like: val foo = bar.a(45).b("Fred").c(x) Yes, some people abuse symbolic method names. Unless your method makes overwhelming sense with a symbolic name (+, -, *, etc), just don't do that. But this problem isn't unique to Scala; poor names can strike in any language. If I called my method "slfjowierlksdfjnas", that'd be bad too. But most developers have enough common sense to choose reasonable names for their methods.