View Single Post
March 3rd, 2013 (11:11 AM). Edited March 3rd, 2013 by Archenoth.
The arch foe
Originally Posted by
Your examples seem more like misleading spacing than anything. The problem I have with operator overloading is that it introduces ambiguity with regards to a given operator. You have to look at the context to figure out what it does, and that's just stupid. What an operator does should be self-evident; it should mean the same thing in every context. Overloading string concatenation is fine I guess because it doesn't do this; you're still essentially "adding" two things, even if internally it's completely different. But a lot of times this isn't what happens; operators are overloaded to mean all sorts of stuff that isn't even remotely related. This is horrible. And letting the programmer do it at his leisure is even worse; at least in C you can guarantee that * is going to mean one of three things and not fifteen other things that the programmer might have defined somewhere.
Misleading spacing was indeed part of it. My point was that you can write code in obvious, and non-obvious ways. The same is true for code that utilizes overloaded operators.
Your code should be consistent and readable. Establish a way you use overloaded operators so that you don't really need context when looking at a given function; Make things obvious.
I won't quote your entire post, but you described your thoughts quite well and had some good points (Even if you were a bit condescending.). While I still don't share your opinion, I understand it better... So have a like.
Joined Jan 2012
View Public Profile
Send a private message to Archenoth
Find all posts by Archenoth
Find threads started by Archenoth
Ignore Posts by Archenoth