From: David M. <Dav...@pr...> - 2001-09-06 09:40:02
|
Dave's question reminded me that there was something that I had been meaning to ask. Structure sharing in ML97 is defined as a textual expansion of type abbreviations. So if we have signature S = sig type s type t end signature T = sig structure A: S and B: S sharing A=B end then this is equivalent to signature T = sig structure A: S and B: S sharing type A.s=B.s sharing type A.t=B.t end But this seems, if I have understood correctly, to have a problem if s or t are anything but a type name. e.g. signature S = sig type s type t = s * s end signature T = sig structure A: S and B: S sharing A=B end appears to be illegal, even though its meaning is perfectly clear. This was actually brought to my attention some time ago by Frank Pfenning who had some code which had compiled under SML/NJ but was rejected by Poly/ML. My feeling is that although this is strictly illegal there is a strong case for allowing it on pragmatic grounds. Is my interpretation correct and what do other implementations do? David. |