Existential operator (was: ||= is much needed?)
herby at mailbox.sk
Thu Jun 21 00:21:54 PDT 2012
Brendan Eich wrote:
> Herby Vojčík wrote:
>> I feel there is objection to introduce magical [[NullPatternObject]]
>> into language, but all of CS-style soft-accesses could be solved very
>> cleanly and consistently.
> No, because (a) the overhead of a new object is too high; (b) with any
> kind of suffix-? or suffix-.? as you proposed it would be observable
> that you get a new object instead of short-circuiting to undefined --
> the new object is exposed in the language.
What's wrong with it per se? Let it be exposed, let people use it. Some
of uses will be wrong, they will eventually die, some of them will be
fine, they survive (no need to add keyword or API for it, null.? yields
it and it is usably short).
And BTW, if foo.? is too long and abuse of dot, you can use for example
postfix tilde to get foo~.bar, foo.bar~(), "bar" in foo~ etc.
More information about the es-discuss