[string_algo] trim_left should be trim_head

After reading Jeff's post about super_string, it suddenly hit me: on RTL languages, the head of the string is actually the right side, so trim_left/trim_right should really be trim_head/trim_tail... I know that the left/right names for trimming are de-facto standard. In fact, they are so rooted, that even a native Hebrew speaker like me didn't get it until just now... But I think that if we want to be 100% accurate, then the head/tail names are more correct. Yuval

Well, it depends on what you define as 'de-facto' standard. I think that both names are equaly good. A quick 2-minute search gives me few example in favor of trim_left: - Microsoft - All libraries provieded by microsoft MFC, ATL, .Net, use *Left versions - Symbian API - has TrimLeft - Probably not very serious, but simple google comparison give following results: "trimhead OR trimhead" : 1,510 results "trim_left OR trimleft" : 40,400 results I don't have much time to look elsewhere, feel free to supply counterexamples. Before considering your proposal, I would really need to see better argument then your personal opinion, since changing a name of a function that is already in use for some time is quite serious issue. Cheers, Pavol. Yuval Ronen wrote:
After reading Jeff's post about super_string, it suddenly hit me: on RTL languages, the head of the string is actually the right side, so trim_left/trim_right should really be trim_head/trim_tail... I know that the left/right names for trimming are de-facto standard. In fact, they are so rooted, that even a native Hebrew speaker like me didn't get it until just now... But I think that if we want to be 100% accurate, then the head/tail names are more correct.
Yuval
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Pavol Droba wrote:
Well, it depends on what you define as 'de-facto' standard. I think that both names are equaly good.
A quick 2-minute search gives me few example in favor of trim_left: - Microsoft - All libraries provieded by microsoft MFC, ATL, .Net, use *Left versions - Symbian API - has TrimLeft
- Probably not very serious, but simple google comparison give following results: "trimhead OR trimhead" : 1,510 results "trim_left OR trimleft" : 40,400 results
I don't have much time to look elsewhere, feel free to supply counterexamples.
I don't have any counterexamples. These examples you supplied are exactly what I meant when I said it's "de-facto standard".
Before considering your proposal, I would really need to see better argument then your personal opinion, since changing a name of a function that is already in use for some time is quite serious issue.
Just my opinion? Strings do not know how they are going to be printed - Left-to-right, right-to-left, top-to-bottom, in diagonal, or in circles. String objects don't have a 'right' or a 'left', only 'head' and 'tail', and that's not just my opinion, that's a fact. All the rest of your functions correctly use head/tail naming, instead of left/right. What is open for discussion is whether to change the name of a function already in use. I agree that it's a serious issue. Perhaps both should be supplied for now, with the right/left gradually deprecated. Or maybe never deprecated and both live together happily ever after. I'm not sure. The important thing is that if you propose it for TR2, I think that it should be head/tail - to be consistent with the rest of the library, and for the noble cause of being correct. Yuval

On Sun, 02 Jul 2006 23:52:55 +0200, Pavol Droba <droba@topmail.sk> wrote:
Well, it depends on what you define as 'de-facto' standard. I think that both names are equaly good.
[snip]
- Probably not very serious, but simple google comparison give following results: "trimhead OR trimhead" : 1,510 results
Just for precision sake: "trim_head OR trimhead"; yes, that yields 1510 results, of which many have nothing to do with programming.
[snip]
I don't have much time to look elsewhere, feel free to supply counterexamples.
Before considering your proposal, I would really need to see better argument then your personal opinion, since changing a name of a function that is already in use for some time is quite serious issue.
It is basically all about conventions. One has to specify that "left" means "head" and right means "tail" (and specify what head and tail are). To illustrate with an example, consider a sentence such as "the cartesian diagram of x = constant is a vertical straight line". Such a statement carries a ton of inaccuracies: a) the cartesian diagram concerns functions, and "x = constant" is not a function: it represents a function b) "vertical straight line" means nothing per se: it should be "line parallel to the y axis" c) bullet b is erroneous too if you only define parallelism between straight lines: an "axis" is not a line, because to be fully specified it needs an ordering between points (it can be defined as a pair (l, R) where l is a straight line and R an appropriate order relation on it). Thus to use the idiom "parallel to the axis" you should specify that "a straight line L is said to be parallel to an axis A if and only if it is parallel to the first component of A" (to which you can give a specific name, for instance "the support of the axis A"). That said, I prefer the trim_head and trim_tail names, even if less popular (and popularity could be a criterion which would lead all of us to use pretty much different names than we use in C++ :)) __ ----------------------------------------- Gennaro Prota, C++ developer for hire resume: available on request ------------------------------------------
participants (3)
-
Gennaro Prota
-
Pavol Droba
-
Yuval Ronen