On Jun 19, 2012, at 2:30 AM, David Bruant wrote:

> What about a more generic operator that would be able to silently absorb any 
> error?
> 
>    let greedy = obj.hints?.greedy;

> 
> would become:
> 
>    let greedy = silent obj.hints.greedy;

A hazard with this approach is that it could silence a broader range of errors 
than the programmer intended.  In the above example, the programmer's intent is 
probably just to not try to access greedy if hints doesn't exist.  However, if 
greedy is an accessor property that throws your silent operator would also mask 
that throw (while ?. would not).  It isn't clear that this would be desirable 
if the throw is an unexpected behavior.

Allen

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to