Talk:Operator overloading

message: Doesn't overloading usually refer to the static resolution of a call?  For instance, + on int vs String in Java is resolved statically.  A dynamic analog of overloading is something like a type-case or virtual methods.  So I think this article should focus on the static case, which means that some of the examples, like LISP, do not feature overloading, because they are statically untyped.  —Preceding unsigned comment added by 12.198.139.122 (talk) 01:57, 6 February 2008 (UTC)
replies: text: Similarly, and with operators in PostgreSQL, where mathematical transformations can be defined on operators and PostgreSQL may use many optimalizations to expressions that use them.
Because I couldn't decipher what the original author was trying to express. If someone can clarify the intent of this passage and wants to put the content back into the article, please do so. Neilc 02:26, 11 Aug 2004 (UTC)
thread_title:  clarification: static vs dynamic 

message: What is meant by "declaring new operators"? 62.194.114.150 10:20, 28 Nov 2004 (UTC)
replies: text: Using operator symbols in the language that have no default meanings, like an operator *** or ## for instance. Pico allows this. Wouter Lievens 10:48, 6 Mar 2005 (UTC)
thread_title:  Declaring new operators 

message: It would be interesting to identify the first language to introduce operator overloading.
Anyone know if any language before ALGOL 68 (1968) implemented it?
Rwendland 02:05, 6 Apr 2005 (UTC)
thread_title:  First language with Operator Overloading 

message: How is it that Ruby permits new operators to be defined?  It seems to me that only existing operators that are part of the syntax can be defined as methods in Ruby.  If that's not what that axis of the chart means, perhaps it should be clarified.
:You're right. We can't define new operators in Ruby. There's a limited set (language's operators, except the following: =, .., ..., !, not, ||, &&, and, or, ::). I'm going to remove it from the list. 01:02, 18 February 2007 (UTC)
thread_title:  Ruby 

message: The ISO/IEC 2382 Standard Vocabularies for IT define an operator as a symbol that identifies or represents an operation. The definition does not limit symbols to single characters. Thus '+', 'add', 'first', 'next' could all be operators.
It is in fact the symbol that is overloaded through reuse. While, hopefully, the operations have similar semantics, the operations are in fact different.
A more accurate statement would be: "Operators are not limited to single characters." As it is, this article appears to contradict a fundamental computing definition and to confuse a symbol with what it represents.
The article lacks citations for verifiability and runs the risk of violating No Original Research or No Point of View.
Bob Badour 15:22, 29 June 2006 (UTC)
replies: text: Come on, in the sentence, the word symbol refers to what everybody understand as a symbol, i.e., a graphical/printed sign (in opposition to letters and numbers), not to the special meaning we in the field of programming also have for it. --euyyn 22:47, 2 July 2006 (UTC)

text: Clearly not everyone understands the word symbol the same. It should be clarified to show the intended meaning, perhaps with something like "punctuation characters," "graphical symbols," or "non-alphabetic characters."--69.181.83.91 16:06, 9 July 2006 (UTC)

text: Isn't the statement referring to something like C++'s conversion operators? 213.38.7.224 12:33, 7 July 2006 (UTC)
thread_title:  Dubious statement regarding symbols and citations needed 

message: are there any known languages that support expression reduction (outside of the compiler)? —The preceding unsigned comment was added by 80.129.243.120 (talk) 23:45, 17 January 2007 (UTC)
thread_title:  samples for expression reduction? 

message: Java allows method overloading, hence it should be moved to another part of the graph. --indil 08:48, 11 April 2007 (UTC)
thread_title:  Correction with Java 

message: We have a bad example; adding two dates doesn't make sense, just as adding two pointers doesn't. We should change it into adding two durations of time, or two lengths, etc. — Musiphil (talk) 19:07, 18 March 2009 (UTC)
replies: text: Done. — Musiphil (talk) 07:27, 23 March 2009 (UTC)
replies: text:  Please accept my comments in the spirit offered?
Adding dates or pointers makes perfect sense for some applications. My concern is more practical in nature.
I would make the changes myself if I understood operator overloading and classes, but I never needed to use them in my work. In some ways that makes me the perfect audience but I cannot figure out the examples because:
1 I never used operator overloading and the concept is alien to me, as is classes
2 the examples do not have a specification explaining in plain language exactly what they are supposed to be doing to which nor are the special data types defined
3 the examples lack line-by-line comments exactly what each line is accomplishing
4 the code is not 'self-documenting' directly from the syntax, especially in the third example which I cannot even make out what its intent is let alone what it is doing
I think we all get the idea of operator overloading being subtle and confusing due to syntax, but that is not what is making this code difficult to understand nor is it pointing out to me why I should care.
Could you please add some declaration of data type and plain language pecification/description of the intended input, operation, and output of each of the three examples? Lacking that, how about line-by-line comments and a general description of what the third cryptic example does?
Then, how about pointing out specifically what is important about the operator overloading, with respect to the second and third examples?
Specifically, I fail to see what the point is for using a 'hidden' variable in the second example. I consider it poor coding style to use global variables without a good reason and in this case it only seems to be justifying the need for a class instead of a simple overload.
What about the global variable justifies the need for a class? Is it the lack of a lhs operand for a typically binary operator? If so, can we have sample instantiation because otherwise the implication is that it uses the same instantiation as the first example? Please state it clearly because it still has me baffled, like I said I never used classes, I did not need object oriented code. I would need to understand everything about classes and operator overloading already to understand the example and in that case what is the point of the encyclopedia?
In the third example I do not even know what it is for. I see no connection between it and the prior two examples, nor is there an instantiation or declaration of data type or anything, nor do I see that it even accomplishes anything since it seems to set everything to zeros. What are its operands? It seems like a ghost that returns no output at all.
Maybe too you could mention some practical implications of the chosen syntax for the overload and alternative coding to mitigate, like what I had to be concerned with such as for example (maybe not my specific concerns for these operator overload samples but similar in character to):
1 potential surprise pointer overflows from improper boundary conditions, and how to prevent this without relying on the compiler to catch it for you, letting J-bird Hacker Jones hijack your browser with data execution and clean out your bank account
2 unexpected processor or memory or stream overhead while executing the code due to practical hardware limitations on bandwidth, flushing the cache for unnecessary jump instruction, multiplying by 2 instead of left shifting, etc.
3 automatic compiler error-checking overhead that might get wrapped around the assembly language, that either mitigates or causes such non-transparent issues, and how to avoid the need for relying on the compiler to clean up sloppy code for you
4 'if' statements instead of modulo operators makes the code longer and more confusing since no one would ever code this way unless processor bandwidth or some other practical hardware constraint demanded it. Can we have examples that make sense mathematically and functionally, so that we can concentrate on the issue of operator overloading?
C syntax is confusing enough without leaving people that should be able to read this encyclopedia entry with ease scratching our heads in puzzlement. Please? thx  —Preceding unsigned comment added by 75.79.69.67 (talk) 13:51, 21 January 2010 (UTC)
thread_title:  Example 

message: : "A classification of some common programming languages by whether their operators are overloadable by the programmer and whether the operators are limited to a predefined set."
Is this really an either/or situation? Are there no programming languages which allow both overloading existing operators, and defining new ones? After all these years I finally ran into a situation where having both features might be desirable in limited cases. Since my available tools are already pretty much set in stone, this is pretty much just an academic question, but I'm still interested.  — Preceding unsigned comment added by 85.156.251.154 (talk) 21:37, 31 October 2011 (UTC)
replies: text: Look at the chart again - it has 4 sections, not 2. For example, Haskell lets you overload operators via type classes and you can use functions as infix operators, or even make them infix by default if you usually want to use them as operators (mod 5 4 is the same as 5 `mod` 4 and 1 + 2 is the same as (+) 1 2). strcat (talk) 12:05, 2 November 2011 (UTC)
replies: text: Thanks, I obviously glossed over the chart and misunderstood it. Turns out, since the label "Limited set" isn't perfectly identical to the explanation "limited to a predefined set", and the most "flexible" languages aren't at the bottom right (or top left?) of the chart, my internal pattern recognition went haywire. Maybe the chart layout is just a tad counter-intuitive, even though it is clearly correct.  — Preceding unsigned comment added by 85.156.251.154 (talk) 17:09, 9 November 2011 (UTC)
thread_title:  Catalog: Classification as either "new definable" or "limited set"? 

message: The phrase "claimed to be useful" is not NPOV and uses weasel words. I will remove it.
Dpsanders (talk) 05:06, 19 August 2013 (UTC)
thread_title: "Claimed"

message: Is there a chance that someone can take a step further back in the discussion and try to explain this to a more novice programmer?  I am one such programmer (FORTRAN off & on for many years, Pascal, BASIC) but I have no idea what the author is saying.  Operator Overloading remains a mystery to me after reading the article.
Thanks for considering  — Preceding unsigned comment added by Mark B 64151 (talk • contribs) 00:17, 4 December 2014 (UTC)
thread_title:  Remedial description 

message: This article lists Smalltalk as one of the languages that allows operator overloading, but I found a textbook on Smalltalk that seems to contradict this. Methods and operators in Smalltalk can be overridden, but I'm not sure if they can be overloaded. Jarble (talk) 17:34, 9 July 2020 (UTC)
thread_title:  Overloading operators in Smalltalk