[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: ISSUE closed: [cgmo-webcgm] Empty string or null
I haven't heard any feedback on this, so I'm going to make a proposal and unless someone objects, I suggest we adopt it. The good news is that I think I've found a solution (and I think its the correct solution)... the bad news is that it's work (I think someone needs to write an ECMAScript binding). The main issue was: when should an implementation return null instead of empty string? And the answer is: it depends on the scripting language. We've agreed that for this version of the specification, we're only interested in an ECMAScript binding, but I don't think the spec wording should be specific to ECMAScript (that's why we have the IDL snippet). We may in the future want to have different bindings (VB, C#, Java etc...) As you know, I've followed the DOM level 2/3 specifications carefully when making proposals for the WebCGM DOM... the DOM level 2/3 specifications often refer to "empty string" and "null" without defining what they really mean; but the answer can be found in the specific bindings. When should an implementation be allowed to return empty string? Ans: in the case of ECMAScript, when the method or attribute returns an object of type "String". When should an implementation be allowed to return null? Ans: in the case of ECMAScript, when the method or attribute returns an object that implements a specific interface. I've research the ECMAScript language: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf And found that a String and null, cannot be compared (see page 55/56) because they are of different types. An ECMAScript interpreter will never return 'true' when comparing a String and null. A String has to be compared with "" (empty string). So we need a document similar to this, but for our DOM: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/ecma-script-binding.html We need the following actions to be taken. - Everyone who wrote tests need to verify that null and "" are used when they are suppose to be used and update their tests accordingly. - We need someone to generate an ECMAScript binding. This will likely result in finding a tool to convert IDL to ECMAScript or writing such a tool themselves. Any takers? - Also, if people have interest in other bindings they should state so now... Regards, -- Benoit mailto:benoit@itedo.com Wednesday, May 18, 2005, 12:47:03 PM, Benoit wrote: BB> Hi Ulrich, BB> In the test you have submitted, we noticed that BB> node-aps.htm, line 22: if( apsNode.nodeValue == "" ) BB> and node-pict.htm, line 21: if( cgmPic.nodeValue == null ) BB> In one case you are comparing with empty string and in the other BB> with null. That seems a bit odd. BB> I'm a bit puzzle by the null keyword in the DOM specification and BB> what it implies in ECMAScript, (i.e., what does it map to?), what's BB> your opinion? (Others can comment as well)... For interoperability BB> concerns, it would be wise to have our implementation have the same BB> mapping. Lofton, I recall you had some comments on this a while back BB> (something to do with undefined)... BB> Assuming your implementation passes both those tests... is your BB> implementation returning BSTRs for both calls or is one of them BB> returning some other data type (say a VARIANT)? BB> Cheers,
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]