Mark H Weaver <m...@netris.org> writes: > David Kastrup <d...@gnu.org> writes: > >> What is confusing here? "Obviously, definitions made in the scope of >> local-eval can't retroactively affect the environment where >> the-environment was called." And now instead of continuing with the >> unfriendly "For this reason, they are prohibited." we continue with >> "You may consider the local-eval body as being wrapped inside of an >> implicit (let () ...)." > > If you want to include local definitions, then you'll need to wrap the > form passed to `local-eval' within (begin ...) anyway. If you're > doing that, why not just wrap them in (let () ...) instead? Is it > really more work to type #`(let () #,@forms) than #`(begin #,@forms) ?
That is embarrassingly correct. I was thinking "body" here instead of "form". Obviously, being able to evaluate a single _defining_ form in its own implicit (let () ...) context is quite useless since there is no way to subsequently use that definition. (cons* 'let '() body) is more complex than (cons 'begin body), but not all that much. > You are suggesting that we wrap the expression within a (let () ...), > for the dubious benefit of allowing you to wrap the local forms in > (begin ...) instead of (let () ...). Are there even situations where you could put definitions after begin? How are they different from the situation where you can't? > I don't see any compelling benefit to this. On the other hand, I see > less elegant semantics and potential confusion among users, who might > reasonably expect the definitions in their (begin ...) to be added to > the implicit `letrec', as would happen if the (begin ...) were put in > place of (the-environment). begin can start with definitions, but not always? But (let () ...) can? Scheme is weird. -- David Kastrup