> Value objects are new under the sun. They are not the same as the primitive 
> AKA value types built into JS. They are typeof-type "object" but equal by 
> value not reference (under the hood there's a pointer-compare fast path, of 
> course). They are frozen so you can't decorate them with expandos to break 
> this equivalence.
> 
> More significantly than typeof-type, value objects may be falsy, e.g. 0L and 
> uint64(0). This is a necessary part of the design.

That makes sense. They are very close to primitives. With universal value 
object types, one could in principle replace primitives with value objects 
(that is neither a suggestion nor a wish of mine ;-).

Continuing the previous idea of a “fixed” typeof as a (shimmable) function, 
such a function could return

1. "null"
2. "undefined"
3. "boolean"
4. "number"
5. "string"
6. "value object"
7. "reference object"

That would cover my use cases.

-- 
Dr. Axel Rauschmayer
[email protected]

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to