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

I dislike using symbols, I think because they draw a mostly-arbitrary line between operators and method calls. As a scala/python fan I like to blur that line, and write code that reads as close to English as possible, so I'd write expressions like

    (user isActive) and (user.expiry before now)
and I think that really is more readable than '&&', in a way that your example obscures because you're still using '>' and 'false'.



In a well-designed, flexible language (which includes Scala), operators are not a special case. In fact, in Scala, they are just methods, so there's no arbitrary line between the two!

I personally like the Haskell/OCaml approach of having operators just be normal functions that happen to be parsed in infix position. It's simple, elegant, uniform and flexible.

Either way, the core idea is that operators should be nothing special.


And Lisp takes this idea one step further by having operators just be normal functions that are in the prefix position like normal functions. This, combined with the explicit parentheses to denote evaluation, mean that operator precedence is not even an issue in Lisp.


Yes, that's exactly my point. You wouldn't use symbols for the names of normal functions (at least I hope you wouldn't).




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

Search: