Why do some languages, D, for example, seem to think operator overloading is a bad thing to have in a language?
Why do some languages, D, for example, seem to think operator overloading is a bad thing to have in a language?
All generalizations are false
Because you can screw stuff up with it, and overload operatures that just don't fit. Still, I am believe that it can be helpful sometimes (especially when writing classes directly related to math).
no its just no body till its to late realizes their value...
Operator overload while dangerour GIVES THE PROGRAMMER POWER TO CAUSE ERRORS THIS IS BAD ACCORDING TO THE RETARDS WHO WRITE LANGUAGES NOW DAYS...
if you can use it and cause an error then its bad and sould be eliminated or slowed down so much during runtime by error checking you cant use it anyway...
Operator overload while dangerour GIVES THE PROGRAMMER POWER TO CAUSE ERRORSCould you give an example of this?Because you can screw stuff up with it,
That seems like a rather silly reason to abolish such a potentially powerful construct from a language.and overload operatures that just don't fit
All generalizations are false
Because it allows you to do this:
What they are saying is that programmers haven't got the common sense not to do this.Code:class a { public: int one; }; int operator+ (a b,a c){return b.one-c.one;} int main() { a b; b.one=10; a c; c.one=8; cout << b+c; return 0; }
>What they are saying is that programmers haven't got the common sense not to do this.
guess so...
and what are their alternatives for this then? just having the programmer take the long hand?
hasafraggin shizigishin oppashigger...
While that I agree it's non-sense to get rid of it from a langauge, it's also not all that much of a "powerful construct". All it does is change syntax. It enables nothing new, other than sometimes more readable code.
it is a debate whether or not overloading operators are worth the coding time they make up for... i think that it depends on the case... if you exploit it enough, then yes... like functions for example, they are a staple of this idea... but if you don't use it to the extent that it will be efficient, then there is no reason to have it... (there are many parts of C++ which i have not used yet as they are impractical on my scale right now... take heed of this...)
hasafraggin shizigishin oppashigger...
i disagree you'll find as you program more that operator overloading is a very powerful and neccessary resource...
>Could you give an example of this?
i won't right the code but i'll say it
i could in fact make divid multiply, plus open a file, minus exit the program, and multiply display a message stating that "you suck!"...ect.ect. this leads to unreadable code...
they seem to think we lack self control... and will make an unreadable unusable mess out of a program...
being the great friends they are they tell us its for our own good...
you don't need a pencil you could write words that could harm you... sounds like a comie programming language to me... hehehehehe j/k
look at java no pointers no references no new no delete no over/under accessing arrays... hence no power
if having pointers means i can screw something up then so be it...
The reason why java doesn't have operating overloading is
someone could define operator++ as substracting. This
doesn't make since someone could define add_apples which
subtracts. There's also mild problems like you can't define
your operators precedence etc.
>if having pointers means i can screw something up then so be it...
i couldn't have said it better myself...
hasafraggin shizigishin oppashigger...