let* is the new var

Jon Zeppieri jaz at bu.edu
Tue Mar 25 15:39:59 PDT 2008


On Tue, Mar 25, 2008 at 6:17 PM, Dave Herman <dherman at ccs.neu.edu> wrote:
>
>  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*.

Is it actually letrec, or is it letrec*?  The example I referred to
(from the proposal page) would require letrec* semantics:

===
if (x > y)
   {
      let const k = 37;
      let gamma : int = 12.7 + k;
      let i = 10;
      let function f(n) { return (n/3)+k; }
      return f(gamma) + f(i);
   }
===

>
>  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.

It's not just the RI; the official proposal is very specific about let
semantics.

-Jon


>
>  Dave
>
>



More information about the Es4-discuss mailing list