Hacker News new | past | comments | ask | show | jobs | submit login

As someone who has seen scala, but never really wrote anything in it, what in heaven's name does that statement do?



It 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: