[bitc-dev] CLEANUP: specification of DEFINE
Swaroop Sridhar
swaroop at cs.jhu.edu
Thu Jul 17 16:19:44 CDT 2008
Jonathan S. Shapiro wrote:
> On Thu, 2008-07-17 at 15:29 -0400, Swaroop Sridhar wrote:
>> So, this change means that
>>
>> (define f ...) is a let form
>
> Yes, except that it does not introduce a new, lexically nested scope
> when it appears at top level.
>
>> (define (f x) ... ) is a letrec form right?
>
> Yes, which is the way the derived form is now specified; it just hasn't
> propagated to the web site yet.
>
>> I have no problem with this interpretation.
>
> Good! How much problem do you anticipate with implementing the
> change? :-)
This is not hard to implement, but re-writing the
(define (f x) <body>) as
(define f (letrec ((f (lambda (x) <body>))) f))
where body actually uses `f' will introduce closure construction for the
lambda being bound, since the lambda is now capturing a non-global
non-local variable `f'.
I guess we can recognize this case by hand, but I wanted to note the
issue.
Swaroop.
More information about the bitc-dev
mailing list