[MLton-user] 'a ref for C programmers: a primer

Matthew Fluet fluet at tti-c.org
Mon Feb 12 11:10:19 PST 2007


Wesley W. Terpstra wrote:
> On Feb 12, 2007, at 7:24 PM, Tom 7 wrote:
>> Of course, if you're interested in the run-time memory layout of your 
>> program, then you need to know about the many ways that MLton might 
>> choose to compile your program. It's true that this is complicated, so 
>> I think it's a good reason to not involve it in the understanding of 
>> the meaning of 'a ref and variable bindings, but only as a pragmatic 
>> issue of writing efficient programs when it is necessary to tune them 
>> at that level.
> 
> Yes, at some point a programmer needs to know what lives between his 
> high-level code and the bare metal.
> 
> Is there an intermediate explanation between the 'value' one and the 
> memory-layout one I described?

Yes, it is known as an 'allocation semantics'.  This makes the heap an 
explicit notion (and sometimes makes the control stack explicit), but 
has no notion of 'local' function variables.

See,
   http://www.eecs.harvard.edu/~greg/cs256sp2005/lec21.txt
for an example.




More information about the MLton-user mailing list