[plt-scheme] determine free variables

From: Sam TH (samth at ccs.neu.edu)
Date: Sat Mar 29 14:19:18 EDT 2008

On Sat, Mar 29, 2008 at 2:12 PM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
> On Sat, Mar 29, 2008 at 11:54 AM, Sam TH <samth at ccs.neu.edu> wrote:
>  >  It seems that #f should only be returned if the binding refers to a
>  >  variable bound at the top-level (the real top-level, no in a module).
>  >  Are you trying to handle this case?  That seems more analogous to the
>  >  module-bound variable case, which are not included in the results in
>  >  either implementation.  Can you describe the code that goes wrong
>  >  without that?
>
>  I think, but I'm not sure, that these ids are once introduced by
>  earlier stages of the compiler. I use free-vars after I convert to ANF
>  form. ANF introduces names for many intermediate values and these
>  identifiers have binding #f. (I get those identifiers from
>  generate-temporaries.)
>
>  I just looked up the docs for identifier-binding and see what you say.
>  I'm not sure what the right answer is. These identifiers are *not*
>  bound at the top-level. Perhaps because I don't fully expand again
>  after introducing them their binding status is not marked when
>  free-vars walks over them?

Indeed, if you introduce bindings, they will have an
`identifier-binding' of #f until a renaming is applied via the
expansion of `let' or `lambda'.

-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.