Existential operator (was: ||= is much needed?)
Brendan Eich
brendan at mozilla.org
Thu Jun 21 11:48:49 PDT 2012
Herby Vojčík wrote:
> Adn that is precisely what I proposed under name
> [[NullPatternObject]]. So all of (1), (3), (4) and (5) are void.
Apologies, I missed that and saw only someone (perhaps it was Domenic)
write ({}) as the default value, which is not the same.
>> Such a Nil proxy still cannot masquerade as false, though, and that is
>> required for suffix-? testing. An object that can convert to false
>> awaits value objects
>> (http://wiki.ecmascript.org/doku.php?id=strawman:value_objects) married
>> with proxies to make value proxies.
>
> Such a [[NullPattternObject]] can ToBoolean to false. No problem I see.
You're right we could hardcode a special case in ToBoolean ahead of
value objects.
To prevent this object from escaping into the language, we would need a
special case in GetValue too. That makes this equvalent to Allen's
conditional Reference (MaybeReference). Or were you thinking of letting
this magic singleton esape into the language?
If so, I think you'll get serious push-back on TC39. Escaping raises the
ante quite a bit. We have to be sure a falsy object won't confuse some
code (SES code in particular) in a way that could lead to an exploit.
Apart from SES-focused concerns, letting the magic reference-like type
escape exposes something ahead of schedule, before value objects in
particular. If there's no need to let this thing escape, then we
sholudn't. And in that case it's equivalent to MaybeReference.
/be
More information about the es-discuss
mailing list