[whatwg] WebIDL vs HTML5 storage changes

Maciej Stachowiak mjs at apple.com
Mon May 19 20:55:42 PDT 2008


On May 19, 2008, at 4:52 PM, Brady Eidson wrote:

>
>> To give you an analogy, even in C++, where you're allowed to  
>> overload operator delete, if you overloaded operator delete to mean  
>> "do not free this object's memory, but do delete the file it  
>> references from the file system", well, let's just say that your  
>> patch would not pass code review with any of your four reviewers :).
>
> But if you overloaded the delete operator to free the object's  
> memory *and* delete its referenced files from the file system, you'd  
> be using the operator overloading in its intended capacity.

I think the analogy between delete in C++ and delete in JavaScript is  
strained. First of all, the two delete operators do totally different  
things. Second, C++ supports general operator overloading for nearly  
every operator. The right analogy would be removing objects from  
collections, and C++ does not have a special operator for that.

(But as a side note I think it would be poor style for C++ code to  
overload operator delete to remove files from the filesystem. The  
right place to do additional resource management would be the  
destructor.)

I do agree that the spec should define a single interoperable behavior  
and we should all converge.

Regards,
Maciej




More information about the whatwg mailing list