0 results from MLton.size

Stephen Weeks MLton@sourcelight.com
Tue, 6 Nov 2001 16:09:44 -0800


> Yes,  I'm using the hash code I found in lib/mlton/basic, although I couldn't
> quite figure out how to link in all the other stuff so I tweaked  it  a  bit.
> (I was going to mail you about this to, but it isn't a big deal.)

To use the library, you should be able to pattern match off of the
Makefile and sources.cm in any of the MLton tools, e.g. mlprof.

> Speaking of this, what is the reason for the single arm  datatype?   Why  not
> just  make  it  be the underlying record?  Is this only because you don't use
> opaque signatures so that it would be too easy  to  get  confused  about  the
> type?

The style is due to poor flexible record inference.  Look at the
functions in hash-set.sml that take a hash set arg (e.g. stats',
resize, maybeGrow, ...).  These typically only use some of the fields
in a hash table record, and so use a ... pattern.  Without a type
constraint, this pattern won't work.  I personally prefer using a
one-variant datatype to impose the constraint instead of writing the
type after a ":".

The lack of use of opaque signatures is another good reason too.

Also, I always prefer to make a new type a datatype to avoid potential
accidental confusion with other types that have the same
representation.