Re:JavaScript Conquered the Web, Now It’s Taking Over the De...
by qwer on Monday September 12, 2016 @06:39PM
(#12484256)
"Made it possible", or "made it look like R"? add() vs. + is just a mild inconvenience IMO compared to the inconvenience of overloading abuse that I normally see ( like sqlalchemy IMO). I'd personally rather know what to expect from an operator.
[ Parent
| on HN ]
Re:JavaScript Conquered the Web, Now It’s Taking Over the De...
by goatlover on Monday September 12, 2016 @07:27PM
(#12484503)
Also, it adds up (no pun intended). You're right that add() vs. + for a simple case when you only do it a few times is no big deal. But it is a bigger deal when you do it a lot, and the arithmetic can be a little more complicated.
We could by analogy apply this argument to adding integers and floats together. It's more convenient to use the + operator for that, but someone could argue that an add() function is just a minor inconvenience, so why bother overloading the + operator?
That is until you have to use it hundreds of times.
Re:JavaScript Conquered the Web, Now It’s Taking Over the De...
by goatlover on Monday September 12, 2016 @07:19PM
(#12484445)
It's not just arithmetic, it's also being able to use comparison operators to filter, which is really convenient. What languages like R do at the syntactic level is make the programming language closer to math, where you can do things like add vectors or multiply matrices using simple operators.