
2011/5/3 Gottlob Frege <gottlobfrege@gmail.com>:
On Sat, Apr 30, 2011 at 10:49 AM, Joachim Faulhaber <afojgo@googlemail.com> wrote:
2011/4/29 Joachim Faulhaber <afojgo@googlemail.com>:
2011/4/29 Gottlob Frege <gottlobfrege@gmail.com>:
On Thu, Apr 28, 2011 at 10:27 PM, Joseph Wu <josephclwu@yahoo.com> wrote:
I think (in order of strength of my opinion) - naming is very important - plus-equal (et al) is better than any of the other options
interesting ... ... could you give us a deeper insight in the superiority of this particular name?
I enjoyed reading your answer. I also think naming is important and specifically in this case because operators are not only at the core of c++ but completely integrated in many fields of language specifically those that use maths in some way. Your main point is the spontaneous and commonly observed "spoken" version of those operator signs. And it took me a little by surprise that this aspect has not been risen before (or has it? I'm loosing overview). I immediately remembered spoken c and c++ during my 20+ years with c/c++ and I notice that I can not compare my auditive experience to yours because my "spoken operatorish" is in German ;-) which is also pretty bizarre, because c++ spoken by Germans it is a wild mixture of German and English words and typically operators are spoken in German by German c++ narrators. This happens in a way as if, in the face of reading c++ operators the human brain degenerated to a lexical scanner that scans the tokens and translates them (using mother tongue) in those words sequentially that it has most frequently been drilled to use for the respective digits. [..]
In over 20 years of programming, across countries and continents, I've never heard anyone call += "plus-assign". I've always heard it called plus-equals.
and it comes, in German tongue, to a similar result as the English speaking brain, using English words: DE: plus-gleich UK: plus-equals
I can get philosophical (and often do) and/or pedantic (again often do), I thus I can understand reasoning about ambiguities, consistencies, etc. But I think common language trumps all that, if it is common enough. So maybe plus-assign is used elsewhere and I just haven't heard it, but I know I hear plus-equals regularly. Also, maybe it is important for standard or near-standard libraries to strive for a higher, well, standard, and thus maybe it is our job to use the "correct" terms.
which may not exist in the domain of naming
But I fear it just comes off too ivory tower, instead of practical and pragmatic, in this case.
agreed
I think about the general problem of naming (of variables in code, etc) a lot (including Bertrand Russell's essays on "the King of Spain", etc),
sounds interesting, is the essay accessible via the web?
and I always think back to when I was a kid and we added a room onto the back of our house (taking us from 800sq ft to 1000, pretty small for a 3-child family, in Canada at least). Anyhow, we always (and still) referred to the room as "the back room". Not "the room at the back of the house" nor the den or family room or back porch or... (because it wasn't exactly any of those things). "the back room" was the shortest but still accurate / unambiguous / descriptive name.
This is how language (at least English, it seems) tends to work - we instinctively find short names that work (or keep looking until we do - which is why a lean towards "supports" or "can-call" or even "has", and which is why this whole discussion exists, I think).
Nice, I like short names as well. BTW, column D not only has the most unifying but also the shortest names.
Now, interestingly, I notice that in everyday talk about = and ==, there can be ambiguity, which is why, when reading code aloud, everyone I've ever heard, says "x equals 10" when reading "x = 10", yet when talking about overriding it, everyone calls it the "assignment operator" since the "equals operator" might be ambiguous. Which maybe is an argument on behalf of "assigns". I notice that "=" is not on the list at all - would it be called "supports_equals" in my scheme? No, I would actually call it "supports_assignment". Yet I'd still go with "supports_plus_equals" for +=. Is that inconsistent? Maybe, but it is (in my world) consistent with common usage. Common usage has decided to favour short words unless there is ambiguity. And thus the scheme would be consistent (plus is plus is plus) except where ambiguity dictates otherwise (equals becomes assignment only when ambiguity forces it to).
Lastly, I often wonder if it comes down to brain chemistry/behaviour/etc. Maybe other people are different, but when I'm typing, I often hear the words in my head as I type it (of course now that I'm conscious of it, typing becomes more difficult!). So I find overly long function names or variable names are actually a hindrance. Not just to typing, but to understanding. If I have to think about "the room at the back of the house" instead of "the back room" it actually affects my thinking. As a mathematician, I will just replace a long term with X or an abbreviation (it seems we all do). This isn't just for shorter typing - for me at least. It is for more concise thinking - if a phrase can be turned into a single word, it can be thought of as a thing of its own (a higher level object) and no longer just a conglomeration of parts.
[..] So, a lot of your very interesting point of view relates to "spoken" language and "spoken" c++ in particular (also inner speaking while typing). Let me repeat this: ... I can not compare my auditive experience to yours because my "spoken operatorish" is in German ;-) which is also pretty bizarre, because c++ spoken by Germans it is a wild mixture of German and English words and typically operators are spoken in German by German c++ narrators. This happens in a way as if, in the face of reading c++ operators the human brain degenerated to a lexical scanner that scans the tokens and translates them (using mother tongue) in those words sequentially that it has most frequently been drilled to use for the respective digits. As stated on the outset, this operatorish narrator produces seemingly natural results e.g. UK plus-equals DE plus-gleich for += that seems to be "paralell natural" for the two languages, but I have heard it producing cumbersome names like DE Prozent-gleich for %= or DE Doppelpunkt-gleich for := (not c of course) because it seems not to "think" very much ;) Since no one ever says "modulus" for % in Germany, but everyone says "Prozent". Everyone would say DE Prozent-gleich for %= which would be 'percent-equals' in English. I see three Problems with your Spokenness Paradigm (1) Spokenness of operators leads to non systematic sometimes awkward conglomeration of parts. (2) There are loads of differences of spoken operators in different languages. (3) Spokenness as a guideline is again not consistently used. Specifically not used consistently within column A We would, for example, need to name pre_increment as pre_plus_plus
Or maybe it is just my opinion and gut reaction. Just one voice,
I can get philosophical (and often do)
The spokenness point of view is a new point of view, well explained. There are other points of view that have more or less been well explained in the quest for correct naming. What let's us be certain, that a point of view A is more valid that a point of view B. Arguments although very interesting seem to be diverse and "organic", dependent on setting some context (spokenness in this case) sometimes fuzzy and ambiguous as language itself. This "correctness" of naming. Can it be measured for a point of view A? Can it be deduced by pure logic? If the answer is NO and all points of view are equally valid, including those chosen for naming in the past, I propose to accept the prevailing naming as valid and opt for the goal of "standard and cross library consistency of naming" (did I mention this already?). In this case the quality of a new naming proposal is even measurable! Moreover the rationals that govern the choice of names is very simple. See https://svn.boost.org/trac/boost/wiki/Guidelines/Naming/Operators
one "vote", hoping that it counts for something.
provided it doesn't drown in flood of words that is called boost mailing list. (I've heard this has happened, watch out!)
But since you asked (thanks for your interest - I do believe you are looking for reasoning and being open to ideas, which is great), when I stop and think about it, I *think* that's my reasoning behind my gut instinct.
Thanks for your thoughts . . . Joachim -- Interval Container Library [Boost.Icl] http://www.joachim-faulhaber.de