Ron, Javascript only works by `assumptions`, that the developer made at the time the code was written than at runtime they will be the same (and not changing by newly ESX).
So, it does NOT make sense to change the code that currently works (expecting to throw error) so that would silently return `null` or `undefined` The behavior of the code would change and perhaps over 90% of the existing libraries would not work anymore. By wrapping code in `try` / `catch` is actually even worse - as adds way extra code and extra penalty in performance. Exceptions should not be used for anything but exception-edge cases. So I presume the answer to your proposals is no and no. And btw, the `?.` is already available in languages like [`Groovy`]( http://therealdanvega.com/blog/2013/08/20/groovys-null-safe-operator), [`Swift`]( https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/OptionalChaining.html) and proposed for [`c# 6.0`]( https://github.com/dotnet/roslyn/issues/5032#issuecomment-152303841). Even [`Ruby`](https://bugs.ruby-lang.org/issues/11537#note-34) has a proposal for the opposite one `.?` doing the same thing. However as I have clarified above `var result = condition ? a?.b?.c?.d : a?.x?.c?.d;` is way unclear / worse, in my opinion, than `var result = condition ? a..b..c..d : a..x..c..d;` Best Regards, Laurenţiu Macovei DotNetWise On Thu, Oct 29, 2015 at 8:30 PM, Ron Waldon <[email protected]> wrote: > Has anyone considering just making dot-property access return intermediate > undefined or null values by default? > > Not having to introduce new syntax would be a bonus. I'm trying to think > of existing code that this would break and can't think of any good examples. > > The only compatibility issue I have thought of so far is code that relies > on an Error being thrown but also does not check the value: > > ```js > let value; > try { value = deep.deep.deep.prop; } catch (err) { /* ... */ } > // use value without even a basic truthy test > ``` > > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

