[HN Gopher] Hammers and Nails, and Operator Overloads
___________________________________________________________________
Hammers and Nails, and Operator Overloads
Author : ingve
Score : 13 points
Date : 2021-01-31 07:53 UTC (1 days ago)
(HTM) web link (davmac.wordpress.com)
(TXT) w3m dump (davmac.wordpress.com)
| AnimalMuppet wrote:
| I for one welcome our operator overloads... um, overlords...
| uh...
|
| [segmentation fault]
|
| Seriously, what's the difference? If you don't have operator
| overloading, then you have to call a function. And an overloaded
| operator _is_ a function call. So what 's the difference?
|
| You can overload + to add matrices, say. That could allocate. It
| could also be buggy and subtract them instead. Or, you could call
| AddMatrices, which could also allocate, and could also be buggy
| and subtract the matrices.
|
| The _only_ difference is that, if you came from C, you might
| expect + to be the built-in arithmetic operator, and only that.
| That is, if you don 't know the language, then the language
| features may surprise you. That's... not news, and not very
| interesting.
|
| I agree with the article. The complainers have a C hammer, and
| they can't see beyond it.
___________________________________________________________________
(page generated 2021-02-01 23:02 UTC)