let* is the new var

Dave Herman dherman at ccs.neu.edu
Tue Mar 25 15:17:23 PDT 2008


> Was let*, possibly under some other name, ever discussed/proposed?
> For let definitions, I think the following is supposed to work:
> 
> {
>   let x = n;
>   let y = foo(x);
>   ...
> }
> 
> That is, x and y should be bound sequentially, not in parallel, right?

Neither, actually -- for let declarations. In your example, both x and y 
are bound in the entire block -- this is hoisting just like `var', 
except it's only hoisted to the top of the block instead of the 
function. This might sound surprising, but this means that it's letrec 
rather than let*.

For let expressions and let statements, though, I agree with you. I 
think we ought to have let* semantics, and as you say I think the RI 
currently implements let semantics.

Dave




More information about the Es4-discuss mailing list