Existential Operator / Null Propagation Operator
christoph.pojer at gmail.com
Tue Apr 7 17:33:55 UTC 2015
it doesn't have to be a bug. It asserts that if a is not
null/undefined, it must have a property b. This can be enforced
through static typing.
On Tue, Apr 7, 2015 at 10:07 AM, Nick Krempel <ndkrempel at google.com> wrote:
> On 7 April 2015 at 18:03, Nick Krempel <ndkrempel at google.com> wrote:
>> On 6 April 2015 at 20:01, Jordan Harband <ljharb at gmail.com> wrote:
>>> If I want the short circuit in option 1, I'd do `a?.b?.c` to indicate
>>> that, whereas in option 2 if I don't want the short circuit, I'm forced to
>>> use separate variables.
>> Worth noting that an option 1 `a?.b?.c` differs from an option 2 `a?.b.c`
>> in that the latter is effectively asserting that if a != null then its b
>> property is also != null, whereas the former is more lenient in what it
>> Also you are not forced to use separate variables in option 2, you can
>> just use parentheses: `(a?.b).c` - hence the whole discussion of lack of
>> transitivity (more correctly, associativity) for option 2. Or did I
>> misunderstand what you're trying to achieve?
> ...but thinking about it further, wouldn't you always want the short circuit
> semantics? i.e. an option 1 `a?.b.c` is almost certainly a bug?
> es-discuss mailing list
> es-discuss at mozilla.org
More information about the es-discuss