Kevin Smith wrote:
`0m` is literal syntax, for `decimal(0)`. Where `decimal` is a
value type factory.
Right - I meant what are the semantics of "===" applied to dissimilar,
perhaps "numeric", value types.
We worked through this in 2008 when IBM was pushing decimal at ES3.1
(now ES5). We do not want 0m === 0 for many reasons, including the relation
typeof x == typeof y && x == y <=> x === y
We also didn't want problems of cohorts differing by significance (1.0m
vs. 1m, if you can believe it) being equated to 1 (the number).
This is one of the reasons I've designed value objects (so far) to allow
typeof customization. (The other is because typeof is *useful* in
numeric contexts, and making all non-number numerics have typeof-type
"object" is useless, a disservice to users.)
There is nothing wrong in my view with well-written == usage. I'm not
Crock. I don't say always use ===. While opinions vary, the fact remains
that == and <= are in the language, are loose, and need to be
overloadable for useful value objects, specifically more numeric types.
Suggest you pull == out of your mental penalty box and look at it again.
It's not a recidivist.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss