Closed Bug 37406 Opened 26 years ago Closed 25 years ago

nsIFile.delete conflicts with JS reserved name[NEED REVIEWERS]

Categories

(Core :: XPCOM, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla0.9.3

People

(Reporter: dougt, Assigned: pete)

Details

(Keywords: arch)

Attachments

(13 files)

No description provided.
Severity: normal → critical
Target Milestone: --- → M16
Here is a real simple patch. I just renamed "delete" to "Delete" in nsIFIle.idl This should be good enough right?? Otherwise if you rename it to "Remove" or something there are member references across *many* files that will need changing. This is a two minute fix. pete
So as I wrote in e-mail, XPIDL style is to name methods and attributes interCaps not InterCaps, so Delete is bad style. How about remove (or *shudder* unlink)? /be
I'll relieve dougt of this. /be
Assignee: dougt → brendan
using uppercase D in Delete() break javascript style guidelins.
I'll vote Break style w/ DougT. Time is an issue here. pete
huh? maybe I did not read what I wrote ;-) , but I did not mean to imply that we should just hack this. If you want, apply this fix to your tree for a few days until we fix it correctly. brendan, i vote for remove(). unlink, although posix and really more descriptive of the action, will cause me ear pain.
Pete: Time is not an issue if you use file["delete"]() from JS, right? In fact we could declare victory and not even change the method name -- too bad that it is reserved in JS. What's the rush to rename to Delete? /be
True. But i just checked, it is not used in any js file I can find. DougT, i was just trying to save you some work. If you change it to remove or unlink etc . . . There is much more work involved there. I'll use file['delete'](); for now. And watch this bug for any changes. thanks pete
For the style purests, you might want to look at: unsigned long Write(in string buf, in unsigned long count); in nsIOutputStream.idl i guess it should be unsigned long write(in string buf, in unsigned long count); pete
The "xpidl capitalizes C++ bindings" change was made a year ago, but then no one swept through and renamed a bunch of methods and attributes to be uncapitalized. It was easier then, because there were fewer scripts and [scriptables]. Oh well. We'll get to it, but two (or N) wrongs don't make a right! I'm going to avoid cleaning up name style incongruence for its own sake, but as part of the Mozilla interface freeze I'm nerving myself to propose, I'll propose that Mozilla XPIDL interCaps style be applied uniformly in the public APIs. /be /be
I'm gonna do something soon. /be
Status: NEW → ASSIGNED
Probable part of API freeze; hope to do quickly, when there are few uses. /be
Target Milestone: M16 → M17
Blocks: 46774
No longer blocks: 46774
Keywords: arch
Target Milestone: M17 → M18
*** Bug 46774 has been marked as a duplicate of this bug. ***
Target Milestone: M18 → mozilla0.9
QA Contact: leger → kandrot
Hey Doug, why not keep delete for backward compatability and then add another method called "rm" or "remove" or something. Then it won't break any existing code and the new name can be used nicely from any js code. --pete
Pete's right, let's extend the vtbl and keep old code working. /be
Slipping and sliding. /be
Keywords: mozilla1.0
Target Milestone: mozilla0.9 → mozilla0.9.1
Attached patch W/out tabs . . — — Splinter Review
Is something like this a good solution? A simple wrapper around nsLocalFile::Delete Interface method name = remove Implementation name = nsLocalFile::Remove --pete
It works: js> f.create(f.NORMAL_FILE_TYPE, 0644); null js> f.exists(); true js> f.path; /tmp/fubar js> f.remove(false); null js> f.exists(); false js>
Is renaming an interface method really the way that kind of naming conflicts should be resolved in XPCOM? Shouldn't XPCOM/xpidl instead define some general rule to escape names which are reserved in a programming language? I.e. prepend a "_" if an IDL-defined name is reserved in the programming language.
My laptop is dying (bad SIMM?), I'm doomed for 0.9.1 unless a patch is in hand. /be
Target Milestone: mozilla0.9.1 → mozilla0.9.2
If i get some review love we can move on . . . --pete
removed shaver by mistake. Sorry. --pete
Verify patch: js> const localFile='/tmp/baz'; js> const File=new Components.Constructor("@mozilla.org/file/local;1", "nsILocalFile"); js> var f=new File(); js> f.initWithPath(localFile); js> f.exists(); true js> f.remove(false); js> f.exists(); false js>
Thanks pete -- let's get this in for 0.9.2. Do you want to take this bug from me (please ;-) ? /be
Sure, lets get this in. Assign it to me. Do i have an sr from you Brendan? --pete
The cvs.mozilla.org trunk is closed for 0.9.1 right now, so wait a week or two for the branch to be cut and the trunk to be opened to 0.9.2 fixes. Review: can you move remove()'s prototype in the .idl file to the very end of the interface, with a doc-comment explaining that it's the new name, and that it is at the end to promote binary compatibility. Deprecate delete while you're at it, with a comment above that prototype. /be
Assignee: brendan → petejc
Status: ASSIGNED → NEW
Test of patch: js> const localFile='/tmp/baz'; js> const File=new Components.Constructor("@mozilla.org/file/local;1", "nsILocalFile"); js> var f=new File(); js> f.initWithPath(localFile); js> f.exists(); true js> f.remove(false); js> f.exists(); false js>
Attached patch patch — — Splinter Review
Keywords: patch, review
Summary: nsIFile.delete conflicts with JS reserved name. → nsIFile.delete conflicts with JS reserved name[PATCH]
This has been sitting in my tree for a veryt long time. Can I get some review love on this? Thanks --pete
Attached patch Patch for review — — Splinter Review
Shouldn't Remove be implemented as "return Delete(recursive);" instead of always returning NS_OK?
Attached patch updating patch — — Splinter Review
moving Target Milestone to 0.9.3 Can we get it in as soon as the tree opens?
Target Milestone: mozilla0.9.2 → mozilla0.9.3
Summary: nsIFile.delete conflicts with JS reserved name[PATCH] → nsIFile.delete conflicts with JS reserved name[NEED REVIEWERS]
Hmm, I'm not sure I agree with this, what exactly are the reasons for just not renaming 'delete' to 'remove', is this method really used that often that changing the name would be that hard (hmm, lxr isn't talking to me right now so I can't tell)? Renaming the method would be better from a backwards compatibility point of view, adding the method causes the vtable to grow which will make the ABI (i.e. binary foot print) of interfaces that inherit nsIFile incompatible with earlier versions whereas reanming the current method simply causes compile time problems that are trivial to fix and no binary compatibility problems what so ever. Are we sure we wanto add this method?
Status: NEW → ASSIGNED
Changing email address
Assignee: petejc → petejc
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
Going w/ jst's suggestions i renamed delete to remove. Can i get a review on this patch? Thanks --pete
sr=jst, assuming that we all agree that this is the right thing to do here, Brendan? Dougt?
remove is fine i guess.
So, Doug is that an r= ?? If so please put it here in writing and i will check it in in the morning and then spam various news groups about this API change. --pete
Why don't you do it the other way around: spam the newsgroups tonight that you care changing the name. If you get no feedback tomorrow night, check it in.... r=me.
Spam today, change tomorrow. I say let's get this over with. Thanks, pete. /be
checked in. --pete
Well, i don't see any flames. Marking fixed. --pete
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
it would have been nice if this had been coordinated with someone checking in the same API changes on the Netscape tree which is now in flames and closed.
I have no knowledge of the Netscape tree . . . Brendan, Doug, jst . . . ? I posted a heads up yetserday to XPCOM ng. Again this morning in the builds ng. I need to be told about such things. I would have gladly coordiniated this had i known . . . --pete
Pete, we (me and dougt) should've told you about that, but I at least simply forgot about it, this is our fault, not your fault. Looks like mcafee already fixed the *one* occurance of nsIFile->Delete() in the commercial tree so there shouldn't be anything to worry about any more.
I suck. I should have caugh this... but just illistrates another reason why the nscp commercial tree should pull a tag of mozilla.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: