Dynamic library issues...
Stephen Weeks
MLton@sourcelight.com
Thu, 25 Jan 2001 09:33:16 -0800 (PST)
> What if that kind of functions are just
> exported as it is - and the representation
> of complex datastructures is just retained -
> wouldn't it then be possible to create and
> load libraries? I know it will only work
> if both library and main program is written
> with MLton, but even that would be very
> interesting :)
This is not so easy. The problem is that MLton relies on having the whole
program in order to make representation decisions. For example, it might choose
to represent (int * char * bool) one way in one program and a different way in
another. What you want is not impossible -- we would just need to decide on
some standard "external" representation for all types, and then MLton could
arrange to convert between the internal and external representations when
crossing library boundaries.
Other things are even more difficult (or pretty much impossible with MLton).
Polymorphism and higher order functions are eliminated at a very early pass in
MLton, and again require having the whole program. Exporting polymorphic or
higher order functions is just not going to happen the way MLton is currently
designed.