On Sat, Oct 11, 2008 at 5:24 PM, Mark S. Miller <[EMAIL PROTECTED]> wrote: > On Sat, Oct 11, 2008 at 1:36 PM, Peter Michaux <[EMAIL PROTECTED]> wrote: >> Simplifying >> >> (lambda (x = 3, y = x) (x+y))() >> >> to just >> >> let (x = 3, y = x) (x+y) >> >> makes it much more clear when reading code what the intention of the >> programmer was. > > If the need for this case were common, that would be something. But > how often do cases come up for which the letrec-like let declaration > is not adequate? In hand written source, I think it's very rare.
This may be true of ES (though, really, it's impossibly to say, since ES doesn't yet have 'let,' and we don't know what idioms will become popular). In Scheme, however, this sort of thing is very common, especially in the named-let form: (define (frob-list lst) (let loop ((lst lst)) ...)) ... is a common idiom. A necessary one? Of course not. Beside the point, since ES has explicit iteration forms? Maybe, but there certainly are cases where tail recursion is more useful in ES than 'for' or 'while' iteration. This is particularly true when constructing closures in a loop, where each closure needs to refer to a distinct element of the iterated sequence. (You really don't want to be mutating an induction variable in these cases.) At any rate, this is, at best, a side issue. I'd just like a non-hoisting 'let.' Based on what you wrote about hoisting earlier in this thread, I'm surprised you don't want one, too. -Jon _______________________________________________ Es-discuss mailing list Es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss