Generator issue: exceptions while initializing arguments

Kevin Smith khs4473 at gmail.com
Mon Sep 10 13:07:55 PDT 2012


>
> But as I pointed out, we have problems already in JS:
>
>   function f(x) {var x; ...}
>
> the var x restates the formal parameter. It does not shadow it.


Ah - observable here:

    > function crazypants(x) { var x; return x; }
    undefined
    > crazypants(123);
    123

If it shadowed, we would expect undefined.  Even so, information can only
flow from left to right across the curly boundary.  That's expected.  But
if we allow parameter default expressions to have visibility into the
function body, then we have bidirectional flow across curlies.

Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120910/76ea421e/attachment.html>


More information about the es-discuss mailing list