[plt-scheme] determine free variables

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Sat Mar 29 13:47:04 EDT 2008

Thanks for the update.

The following difference remains:

Your id case is:

[id
     (identifier? #'id)
     (if (eq? 'lexical (identifier-binding #'id))
         (list #'id)
         null)]

While mine is:

(let ([i-bdg (identifier-binding #'id)])
          (cond
            [(eqv? 'lexical i-bdg)
             (list #'id)]
            [(not i-bdg)
             (list #'id)]
            [else
             empty]))

I don't think eq/eqv matters. But when the identifier-binding is #f
does. I find many errors in transformed code if these are not
considered free. I don't really understand why, but I believe I came
to this particular test by looking at what the macro debugger said
some obviously free vars identifier-binding was.

I presume that your implementation will be much more efficient than
mine, btw, given its use of identifier mappings.

Jay

On Sat, Mar 29, 2008 at 10:41 AM, Sam TH <samth at ccs.neu.edu> wrote:
> On Mon, Mar 24, 2008 at 9:18 PM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
>  > That's interesting.
>  >
>  >  A note though: that implementation doesn't handle
>  >  letrec-syntaxes+values which isn't in true fully expanded code, but
>  >  will show up in the result of local-expand with an empty stop list.
>  >  (I've talked to mflatt about this and he said there isn't a way to get
>  >  true fully expanded code.)
>
>  This is now fixed.  If you could take a look at it and see if there's
>  anything else that needs to change for you to be able to use it in the
>  webserver, that would be great.
>
>  Thanks,
>  --
>
>
> sam th
>  samth at ccs.neu.edu
>



-- 
Jay McCarthy <jay.mccarthy at gmail.com>
http://jay.teammccarthy.org


Posted on the users mailing list.