On Fri, May 1, 2015 at 11:10 AM, Jonathan S. Shapiro <[email protected]> wrote: > The habit in functional languages has been to use something like "let" as > the top-level binding form. This grants economy of mechanism, but it leads > to a design inconsistency. > > On the one hand, the bindings in a LET should go out of scope when the let > does. If so, it should follow that in the following code: > > let x = 5 > in > ... > > let x = 3 > in > ... > > > x is not rebound because it has gone out of scope. Most functional languages > nonetheless diagnose this as a rebinding. > > Does anybody else find this distasteful and confusing?
this doesn't really seem to be the case for SML, values go out of scope when the let does, sequential lets act as EXPR EXPR would let in print end let in "foo\n" end; is the same as print foo; so to get multiple non-interacting top-level lets you must introduce the semi-colon to represent the end of a compilation-unit (or something) let val a = 0 in () end; let val a = 1 in () end; neither of he a's escape only the unit result, so something like the following is a compilation error because let val a = "foo" in print end let in a end Error: unbound variable or constructor: a so it's not actually a rebinding there... _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
