[MLton-devel] monomorphisation and the opus

Henry Cejtin henry@sourcelight.com
Fri, 9 May 2003 16:00:35 -0500


I  think  that  the  connection  between  what MLton does and the polymorphic
recursion case is more direct than other people are thinking.   My  point  is
that  if  a  program  has an unbounded number of types, then you really can't
monomorphise the program.  Any nonlinear datatypes automatically mean you  DO
have an infinite number of types.  The absence of polymorphic recursion means
that there is a very  similar  program  which  does  NOT  move  any  distinct
original  types  into  one  new  type.   I.e.,  no information is lost in the
translation.

If  you  have   polymorphic   recursion   and   nonlinear   datatypes,   then
monomorphisation  REQUIRES  loss  of  information.  In a world with that, you
have to face facts:  the  type  system  after  monomorphisation  talks  about
runtime  types.   That before talks about the types as they are in the source
program.  Even in the SML case, this  is  still  true,  you  can  just  avoid
thinking  about  it  most  of the time because the change is so small.  It is
just a bit of an INCREASE  in  the  amount  of  information  that  the  types
express.

In  the  absence  of  runtime code generation, you can ALWAYS monomorphise in
this sense because since there is only a bounded amount of  types,  you  only
need  a  bounded  amount  of  replication.  I think that is the real point of
Okasaki's statement.

Any way, Matthew is right that MLton doesn't do polymorphic recursion,  which
is  absolutely  fine with me, but there is a real argument to talk about this
in the opus I think.  One is that it shows the Haskell people that  they  are
not  at  all unreachable.  Since most (probably all) Haskell compilers do not
generate code at run time, they also only have a bounded  number  of  runtime
types.   It  is just a matter of translating the source program to use those.
Not losing information is good, but if you are going to use on chunk of  code
for  two  different types, then in the end, that really means that at runtime
those two objects have the same type.


-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com

_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel