Hi Noah, On Sun 03 Jun 2012 16:20, Noah Lavine <noah.b.lav...@gmail.com> writes:
> I've always been puzzled about part of the variable allocator. In > module/language/tree-il/analyze.scm, we deal with allocations, which > are hash tables that say where in the stack each local variable goes. > The maps are two level, symbol -> {lambda -> location}. The reason > given is that different lambdas could have different variables with > the same symbol. > > But if I understand correctly, each variable also gets a gensym, and > the gensyms are globally unique. So wouldn't it be possible to use the > gensyms as keys instead, and only have a single level map? If so, why > don't we do it? AFAIR the reason is not to permit multiple lexically bound variables with the same gensym, but to provide for different allocations of the same variable in different closures. Thus a variable might be at local 5 in one closure, free variable 3 in another, free variable 6 in another, etc. Cheers, Andy -- http://wingolog.org/