Consistency in The Negative Result Values Through Expansion of null's Role

Brandon Benvie brandon at
Sat Aug 18 13:29:26 PDT 2012

In light of this thread and the recent discussion about some kind of .?
 operator, I thought it'd be cool to actually make this and try it out. By
having a bit of fine with the V8 API's* _MarkAsUndetectable_ *function and
building on top of that, I was able to make a node module as an experiment
in seeing it in action. Sadly I couldn't reproduce the behavior in
Spidermonkey (the API is unimplemented in v8monkey and I couldn't find a
way to do it).

I created an object (called nil) that is marked as undetectable (typeof is
'undefined', in null equality class, falsey) that returns itself for all
property access (except for toStrnig), returns itself when called as a
function, has null as a prototype, and returns the empty string when
coerced to string.

I also implemented a rough proxy wrapper that allows you to wrap an object
such that in all places it normally would return undefined instead returns
nil. I also created a recursive membrane version that wraps all
non-primitive return values with the same kind of handler.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list