Brendan Eich wrote:
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?
Definitely. It brings all pros of Null Pattern there (all of the uses I
included in previous posts, automatically and consistently).
When it is explicit, users can begin to use it willingly. It may bring
previously hard-to-get solutions.
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.
That I cannot envision... but Null Pattern object that produces itself
for all operations ([[Get]], [[Call]], ...) should not be problematic.
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
Herby
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss