-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
I've been trying to use the module system and come across a few issues, some of which I cannot easily pin down, and one which I can.
The issue I can clearly identify concerns what seems to be failure of associativity in structure sharing, and is demonstrated in the following:
signature ORD_DATA = sig type data end; signature VERTEX = sig type name type data end;
signature BVERTEX = sig structure Boundary : ORD_DATA include VERTEX end;
signature GRAPH = sig structure Vertex : VERTEX type T; end;
signature BGRAPH = sig include GRAPH; structure BVertex : BVERTEX sharing Vertex = BVertex end;
signature RG_VERTEX = sig include BVERTEX where type Boundary.data = unit end;
signature RG_GRAPH = sig include BGRAPH structure RGVertex : RG_VERTEX sharing BVertex = RGVertex (* why is it OK if I change BVertex to Vertex? *) end
Running this gives the error: Error: in '/tmp/sml25644bEn', line 26. Cannot share: (unit) is a type function Found near sig include BGRAPH structure RGVertex : RG_VERTEX sharing BVertex = RGVertex end
Exception- Fail Static errors (pass2) raised
Apart from just being confused by what the error means, I am confused that given, in BGraph, "sharing Vertex = BVertex", later I get an error if "BVertex = RGVertex" but not if "Vertex = RGVertex".
Is there some subtle (or obvious?) thing I'm missing?
Another thing I don't quite understand, but which I suspect is just part of the definition of ML, is that you cannot write "sharing type localtype = globaltype", is there some clever reason why this isn't allowed? Or even "sharing local_structure = global_structure", would sometimes be nice. :)
The other issue I have is with the names given to types being printed in error messages; is there any way to control this? I sometimes seem to get mis-typed types; which makes errors hard to spot. A common thing I find is that a parameterised type loses it's parameter. I have example of this I can repeat, but they require a large amount of code... I'll try to find a smaller example.
any suggestions/corrections/infomration, and possibly bug fixes, very welcome! :)
cheers, lucas