// Excuse my beginner’ English
I have a few (3) thoughts:
1. binary ?.
If a === null: a?.b.c === undefined
If a?.b === null: a?.b.c // throws exception
If a?.b === null: a?.b?.c === undefined
If a === 0: a?.b.c === undefined
If a === '': a?.b.c === undefined
If a in not defined: a?.b.c // throws exception
If a === undefined but defined: a?.b.c === undefined
2. unary ?.
window?.navigator?.toString()
browser: "[object Navigator]"
node: ReferenceError: window is not defined
here i suggest syntax for exception-slient accesing globals:
?.a === hostGlobalObject?.a
?.a?.b === hostGlobalObject?.a?.b
3. groupped ?.()
Syntax for the full existential chain case:
.?(a.b.c) // equals with typeof a !== 'undefined' && a.b && a.b.c
I use .? here too because ?:
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss