[MLton] MLTON_THREAD

Matthew Fluet fluet@cs.cornell.edu
Fri, 20 Aug 2004 11:32:50 -0400 (EDT)


> I slightly prefer Runnable.t to Ready.t.

Agreed.

> I'm thinking that the common case will actually be prepVal, and that
> with prepVal already defined, then prep is not really needed.  Putting
> it all together, how about the following?
>
> 	val prepare: 'a t * 'a -> Runnable.t
> 	val prepareFn: 'a t * (unit -> 'a) -> Runnable.t

I disagree:

[fluet@tiger regression 5]% grep prep * | wc -l
     29
[fluet@tiger regression 6]% grep prepFn * | wc -l
      1
[fluet@tiger regression 7]% grep prepVal * | wc -l
      6

And 4 of those prepVal's are in thread0.sml, which goes out of it's way
to send different values to the thread.  And the only prepFn is in
timeout, where it could actually be a prepVal.  But, in any case, pure
prep's dominate.

[fluet@tiger core-cml 13]% grep prep * | wc -l
     37
[fluet@tiger core-cml 14]% grep prepVal * | wc -l
     16
[fluet@tiger core-cml 15]% grep prepFn * | wc -l
      3

So, I prefer:

 	val prepare: unit t -> Runnable.t
 	val prepareFn: 'a t * (unit -> 'a) -> Runnable.t
 	val prepareVal: 'a t * 'a -> Runnable.t