[MLton-devel] new basis library

Matthew Fluet fluet@CS.Cornell.EDU
Sun, 28 Jul 2002 17:13:14 -0400 (EDT)


> > I don't think so.  It is important to distinguish between arrays and
> > vectors because they have different equality properties.  But I don't
> > see any distinction between strings and char vectors.  You could try
> > removing string from PRIM_TYCONS and adding "val string = vector char"
> > to atoms/type-ops.fun and see what happens.  It looks like it will
> > cause a few problems, the most difficult being that constants types
> > are no longer describable via a tycon, but nothing too bad.
> > 
> > This sounds worth trying to me.
> 
> O.k.  I'll probably take another serious look at the basis so far over the
> weekend, trying to incorporate the CharVector and String ideas and seeing
> how the opaque signatures work out.

Making string = char vector within the basis was fairly straightforwards. 
Only ConstantPropagation ever seemed to care that a string constant might
be coerced to a vector, so there are a couple of special cases there.

On the down side, this has completely trashed check-basis.  The problem is
that SML/NJ continues to interpret string constants as it's primitive
string type, not as our char vector.  The solution should be fairly
straightforward, I would think: add
STRING_CONST (x:string) : char vector = raise (Fail "<string const>")
to the top of the built basis.sml and wrap every string constant in the
basis with STRING_CONST.  Unfortunately, that's not the simplest of
reg-exps to write -- we need something that doesn't match character
constants, but does match string constants with possibly escaped quotation
marks.  And, the above switch doesn't work for string constants used in
pattern matches, but I didn't see any in my perusal of the basis library
and they would be easy enough to desugar if need be.

Oh yeah, the other problem is that we don't want to replace the string
literals that appear in #line directives.

I moved a bunch of substring and string functions back into sequence.fun
and propagated them with the _EXTRA signatures.
I added top-level/{basis-sigs.sml,basis.sig,basis.sml} to start getting
the opaque signature matching to work out right.  It looks o.k., but
check-basis is working, I'm not convinced that it's doing what we want, or
that all the necessary constraints are there.




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel