[MLton] MLton.Vector.create
Henry Cejtin
henry.cejtin@sbcglobal.net
Tue, 28 Mar 2006 15:19:39 -0600
You can't quite always do what you want before calling the create without
using a ref cell and perhaps an extra option. If I need to use some function
closed over sub or update, and that is what the tabulator is going to use,
then I would have to use a ref cell carrying an option type and fill it in
the first time that the tabulator was called.
I missed that you couldn't sub/update the last element in the tabulator ever.
Bad.
Funny, I think that you convinced me that the currying in the tabulator
should stay. The computation being staged could be useful, and also implies
that the sub and update functions don't vary between different invocations of
the tabulator.
Ah yes, I was just thinking of the second version, where you pass sub/update
once and get back a tuple of the tabulator and a whacker. I definitely like
this one much more. It makes it clear that there is only one sub/update, it
being the same for all invocations of the tabulator and the whacker. It lets
you stage things in a perhaps useful way (building closures and data
structures once that are used both by the tabulator and the whacker).
I still am a bit disturbed by the complexity of the restriction on calling
sub/update from the tabulator, but with the whacker being separate, in the
case that the old code could handle one just wouldn't refer to sub or update
at all in the tabulator, so it is syntactic.