Closed Bug 75220 Opened 24 years ago Closed 23 years ago

[API] fix string names

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.0

People

(Reporter: scc, Assigned: scc)

References

()

Details

Attachments

(9 files)

Waterson points out that `local' strings don't have to be local and the name isn't as helpful as he would like. Shaver and jag have the same attitude towards `promises'. nsPromise[C]Subtring --> nsDependent[C]Substring nsLocal[C]String --> nsDependent[C]String nsPromise[C]Concatenation --> nsDependent[C]Concatenation nsCommon[C]String --> nsSharable[C]String |nsPromiseFlat[C]String| is a good name that we should keep, I think. It's more complicated than a simple dependency, since it may copy. It's still a question how the string converter classes fit into this.
Blocks: 73009
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9
I just read the string_iterator doc, and the Capitalize example triggered a name discussion in my head: The sample changes the fed string in place, but copy_string(S.BeginWriting(), S.EndWriting(), Capitalize()); sounds like Capitalize() couldn't change S to me. How about feed_string? iterate_string? Axel
These are the 0.9 bugs that didn't make it, and that I intend to fix in 0.9.1
Target Milestone: mozilla0.9 → mozilla0.9.1
Promises --> IsDependentOn
Summary: fix string names → [API] fix string names
re-targeting milestones, starting from a clean slate
Target Milestone: mozilla0.9.1 → ---
All planned string API fixes need to be in by mozilla1.0.
Target Milestone: --- → mozilla1.0
I agree dependent comes to mind due to a direct data dependency, but Wrapped is shorter and sweeter IMO for at least what is currently nsLocal[C]String. Or am I weird? /be
nsDependent [C]String nsWrapped [C]String nsWrapper [C]String nsWrapping [C]String nsWrapper has my preference as a replacement for what's currently nsLocal. Especially if the new nsLocal[C]String will double as what currently is nsXPIDL[C]String, "dependent" won't apply in the |getter_Copies| case.
Re: wrapped But it's not wrapped or wrapping or a wrapper. The only string that comes close to that definition, in my mind, is |nsPromiseFlat[C]String| which keeps a reference to another string, and forwards calls through it. The closest name to the real concept of a dependent string is `non-owning'. Negatives in identifiers are usually problematic. A dependent string managing access to a local stack-based buffer is no more a wrapper than the longer-lived heap-based string is a wrapper for _its_ buffer. If this were the case, all strings could be considered `wrappers'. In both cases, the string in question might well be the only string pointing at that buffer. One asserts ownership, the other doesn't. The key information to communicate to clients is that a dependent string has a dependency on data that the client must, themselves, manage, e.g., by controlling the lifetime with suitable declarations. Dependent strings are dependent on somebody else's data. They are dependent on the client ensuring that the data in question stays around for the useful life of the dependent string. To my, perhaps jaded, eye, `wrappe[rd]' doesn't convey this information. Re: |nsXPIDL[C]String| In the |getter_Copies| case, the destination string must accept ownership, so this will be some transformation that results in nsSharableString /* nee |nsCommonString| */::rebind( ptr ) The |getter_Shares| case must make a dependent string nsDependentString /* nee |nsLocalString| */::rebind( ptr ) This change is not going to end up being transparent. It's not worth making a class that alternatively acquires ownership for the eleven instances of |getter_Shares| in the tree http://lxr.mozilla.org/seamonkey/search?string=getter_Shares In my opinion, it's better to keep a clear distinction. Instances of such-and-such a class _always_ own. Instances of such-and-such _never_ own. Admittedly, |nsPromiseFlat[C]String| conceptually breaks this guideline already (though not physically).
The easy path to this starts with some file _copying_ in the cvs tree string/public/nsPromiseSubstring.h,v --> nsDependentSubstring.h,v nsLocalString.h,v --> nsDependentString.h,v nsPromiseConcatenation.h,v --> nsDependentConcatenation.h,v nsCommonString.h,v --> nsSharableString.h,v /src/nsPromiseSubstring.cpp,v --> nsDependentSubstring.cpp,v nsLocalString.cpp,v --> nsDependentString.cpp,v nsPromiseConcatenation.cpp,v --> nsDependentConcatenation.cpp,v nsCommonString.cpp,v --> nsSharableString.cpp,v Copying for now. I'll fix the names within the new files, then add them to the build and export, then make the rest of the tree use the new names, then remove the old files (with appropriate reviews at the appropriate stages).
your files have been so copied. mekkalekkahai, mekkahaineeho.
Blocks: 74726
reviews requested of jst and vidur on the first patch attached above, to unblock my work in bug #74726 (email sent, and cc'ing reviewers@mozilla.org).
r/sr=jst
So the decision on #mozilla, given Mirriam-Webster's friendly input, is that these should be called |nsShareable[C]String| ("e" added). Once you have the files in CVS renamed, you should be able to automate the rest of the renaming process with a little unix command-line ingenuity (my guess is some combination of sed and xargs will ease the pain). r=dr, conditional on the name change.
Nominating for 0.9.2, while I'm at it. The sooner APIs can stabilize, the better... I'm hoping the same process of converting Common to Shareable is quickly repeatable for the other naming changes :)
Keywords: mozilla0.9.2
scc: That patch is broken. It uses "Shareable" in some places and "Sharable" in others.
scc, you acquiesce too quickly. ``sharable'' is a perfectly valid spelling, and dictionary.com agrees, though Mr. Webster's revisionist tendencies might have made him loath to accept it. Perhaps more importantly, we already have nsAWritableString, and choosing the elided-e form for one class, and the retained-e form for another is sure to permanently confuse our spelling-challenged colleagues. scc, please use ``nsSharable[C]String''. (By the way, Dan, it's ``Merriam-Webster''.)
> ``sharable'' is a perfectly valid spelling, and dictionary.com agrees, though > Mr. Webster's revisionist tendencies might have made him loath to accept it. m-w.com places "sharable" as an alternative sharing of "shareable", and it was dbaron's opinion on irc that the former was "funny-looking." However... > Perhaps more importantly, we already have nsAWritableString, and choosing the > elided-e form for one class, and the retained-e form for another is sure to > permanently confuse our spelling-challenged colleagues. I'll defer to this argument. Using "sharable" makes a lot more sense in the context of consistency with prior naming. scc: You have my r= on the first patch, unmodified. Sorry to give you trouble here.
Patch changing |nsCommon[C]String| --> |nsSharable[C]String| checked in.
The patch above fixes the names in the new files, adds them to the build and exports the appropriate headers. After that patch is checked in, a further patch will typedef the old names into aliases for the new; remove the old implementations from the build; and fix all users of the old names; and finally cvs remove the old files. This first patch can be checked in safely before those changes though, and is worth reviewing separately.
No longer blocks: 74726
sr=vidur. Remember to get rid of the #if 0 in nsDependentConcatenation.h for the two global operators once you do the typedefing and remove the old implementations from the build.
Also remember to remove the direct include of nsDependConcatentation.h from nsDependConcatentation.cpp when the rest of the fixup is complete. Why the ifndef around the include right now? +#ifndef nsDependentConcatenation_h___ +#include "nsDependentConcatenation.h" +#endif
The above patch fixes everything in the mozilla tree except soap. I'll generate a patch for that on my windows box. Need to coordinate with the commercial tree before we can check this stuff in.
I can check in the patch above at will (i.e., not coordinating with commercial or soap) if I also add the following |typedef|s in "nsLiteralString.h" and "nsDependentString.h" respectively typedef nsDependentString nsLiteralString; typedef nsDependentCString nsLiteralCString; typedef nsDependentString nsLocalString; typedef nsDependentCString nsLocalCString; with appropriate comments about their `temporary-ness'. Then we can fix commercial and soap separately, and finally remove these typedefs. Review for the patch above should be considered in this light. Given the size of this patch (~100k) I'll send email to three reviewers hoping for two reviews :-)
Index: embedding/browser/powerplant/source/UMacUnicode.cpp =================================================================== RCS file: /cvsroot/mozilla/embedding/browser/powerplant/source/UMacUnicode.cpp,v retrieving revision 1.5 diff -u -2 -r1.5 UMacUnicode.cpp --- UMacUnicode.cpp 2001/03/02 09:24:53 1.5 +++ UMacUnicode.cpp 2001/05/18 22:11:59 @@ -233,4 +233,4 @@ memcpy(charBuf, &aIn[1], aIn[0]); charBuf[aIn[0]] = '\0'; - return PlatformToUCS(nsLiteralCString(charBuf), aOut); + return PlatformToUCS(nsDependentCString(charBuf, aIn[0]), aOut); } Looks really weird, but I think it's ok, except that it's doing one unecessary memcpy, or did I misunderstand that code? Either way, I'm ok with this change, just thought I'd mention it. Other than that the changes look good to me, r/sr=jst
r=vidur for the last 3 patches. The SOAP module is currently not part of the standard build, though fixing it up makes sense if others are building it. Note that a new version of the module is being worked on on a branch.
r/sr=jst for the changes, please note that the commercial tree still uses nsLiteralString (~30 places), so those need to be fixed before we can remove the typedef's completely.
soap and |IsDependentOn| patches checked in; still need to fix commercial before I can check in the patch that removes the |typedef|s (05/21/01 05:40).
This latest patch (05/22/01 05:20) updates the earlier patch that removed the |typedef|s for |nsLiteralC?String| and |nsLocalC?String|. The updated version fixes stragglers that have been checked in since. mscott is holding the matching commercial fixes in his local tree till the commercial tree opens. After he checks those in, I can land this final patch and close this bug.
final patches checked in. I'll CVS remove the unused files anon.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: