"Joshua Scholar" jscholar@access4less.net wrote: I was thinking about iteration and closures the other day. Smalltalk blocks are becoming the equivalent of lambdas, but in Scheme, the block inside of a loop does not have to be a lambda, and can use the outer environment I think... So when we slow our loops down in order to create a new environment for each iteration, we're doing something that Scheme and Lisp didn't I think. I'll have to write some Scheme programs to be sure. As an old Lisper I must say I find his description of Scheme unrecognisable. The basic loop form in Scheme is named-LET:
(let <name> ((<v1> <e1>) ... (<vn> <en>)) <body>)
which is precisely equivalent to
(letrec ((<name> (lambda (<v1> ... <vn>) <body>))) (<name> <e1> ... <en>))
"do" is also defined in terms of rewriting to a recursive "lambda". "In Scheme, the block inside a loop" _is_ (the body of) "a lambda". It "can use the outer environment" because so can all lambdas in Scheme. And so, of course, can blocks in Smalltalk. Scheme _does_ create a new environment (in principle) for each loop _entry_ but not for each loop _iteration_. And so does Smalltalk. Squeak does *NOT* "slow our loops down in order to create a new environment for each iteration".
squeak-dev@lists.squeakfoundation.org