On Jun 21, 2012, at 3:22, "Herby Vojčík" <he...@mailbox.sk> wrote:
> > > 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. > >> /be > > Herby Language-level support for the null object pattern would be pretty excellent! I think, given the CoffeeScript grep stats (not to mention common `options = options || {}` code), people are definitely using ? in that capacity. The possibility of introducing something elegant like this seems like exactly why getting in only property-access ?. would be a mistake. _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss