[MLton] space safety for structures
Daniel C. Wang
danwang@CS.Princeton.EDU
Fri, 02 Jul 2004 18:25:19 -0400
Stephen Weeks wrote:
>>Perhaps, I'm missing something, but this is my model of how seperate
>>compilation works.
>
> ...
>
>>fun main () =
>> val {x=Sl,l=Sx} = S ()
>> val _ = T ()
>> val _ = U Sx
>>in ()
>>end
>>
>>Here its clear that l is dead at runtime after we execute the effects
>>associated with S. Anyway, this is my model about how it should work.
>
>
> That makes perfect sense. Is that what SML/NJ does? For some reason
> I always had the idea that it was passing around records for
> structures and that the destructuring occured within each module, not
> in some global main module like you have above.
I'm not the expert, but CM does lots of magic with both "static" and
"dynamic" environments. The static environments I assume map identifiers to
code, while the dynamic environments deal with runtime objects. There of
course is special magic in the REPL to make sure the dynamic environment
doesn't hold on to bindings that are shadowed as new values are added to the
system by the REPL.
Linking in CM SML/NJ is mostly about composing and filtering environments
appropiately. I don't think it deals with tuples in the way you first suggested.