local

Jon Zeppieri jaz at bu.edu
Fri Aug 22 09:52:50 PDT 2008


On Fri, Aug 22, 2008 at 10:22 AM, Ingvar von Schoultz
<ingvar-v-s at comhem.se> wrote:
>
>    let (a = 3)
>    {   x = 5;
>    }
>
> If you put |let (a = 3)| above your block, this might tell the
> compiler that you want everything neatly declared at the top,
> and therefore want an error thrown at the undeclared x. A strict
> mode regarding declarations.


var x;

let (a = 3) {
  ...
  x = 5 * a;
  ...
}

This is perfectly reasonable code.  If the assignment throws, the
language is broken.
Now, if you erase the "var x" line, the only difference, semantically,
is that the assignment is to a property of the global object.  Not
great style, but I'd still expect it to work.

-Jon


More information about the Es-discuss mailing list