Lars Hansen wrote:
> The operators |==| and |===| compare as equal two |Name| objects that
> are separately created from the same (qualifier,identifier) pair;
> similarly, the operators |!=| and |!==| compare as not equal two |Name|
> objects that are separately created from (qualifier,identifier) pairs.
This is a non-sequitur. I agree with the intent, but, as stated this would
indicate that:
!(new Name(123) == new Name("123")) from the first clause
Worse, as written, both
new Name("abc") == new Name("abc")
and
new Name("abc") != new Name("abc")
would be true!
What you want to state instead is that |Name| objects are equal iff their
qualifier and identifier properties are equal.
What happens if you call new Name() with either zero or three or more arguments?
var x:Name = new Name(my_namespace, "xyz");
var y:Name = Name(x);
Now x is as you'd expect, but y is a Name whose namespace is null and
identifier is "MyNamespace::xyz" (or whatever toString does on x).
The relational operators are broken on Name objects. For example,
a <= b
is not equivalent to
a == b || a < b
For another example, you can have two Name objects for which none of
a < b, a == b, a > b
is true. This makes it difficult to sort these, put them into ordered
containers, etc.
The counterexamples to these invariants are the very x and y from the prior
example :-).
Waldemar
_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss