[TYPES] Issues regarding typeclasses and modular languages like ML
Brian Hulley
brianh at metamilk.com
Thu Apr 9 20:13:19 EDT 2009
Dear Andreas,
Thanks for elucidating the relevance of [2] and [3] to my questions. If I've now understood things right, then I assume that in the example below (in the language of [3]), the sealing operation has actually done something quite interesting: not only has it created a new statically distinct type (t) but it has also created a new instance declaration (instance t C) that is implemented by the instance declaration (instance int C) inside M.
class 'a C with ...
structure M = struct
type t = int
instance int C with ...
end
structure N = M :> sig
type t
instance t C
end
Perhaps I shouldn't really find this interesting but somehow an instance declaration seems like quite a different thing from a simple val or type binding and hence the above does seem slightly mystifying. However I agree that the MTC paper seems like the more elegant approach so I'll leave the subtle clouds of mystery in the above to float away... ;-)
Best regards, Brian.
[2] "Generativity and Dynamic Opacity for Abstract Types (Extended
Version)" Andreas Rossberg. 2003
[3] "ML mit Typklassen" Gerhard Schneider. 4th June 2000.
More information about the Types-list
mailing list