Browse thread
Polymorphic method question
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2006-07-11 (02:24) |
From: | skaller <skaller@u...> |
Subject: | Re: [Caml-list] Polymorphic method question |
On Mon, 2006-07-10 at 16:25 -0700, brogoff wrote: > The restriction on polymorphism in mutually recursive class > definitions makes the idea unworkable. Any possibility that restriction will be > lifted? I don't believe there is such a restriction: the problem is when you introduce other types such as variants which must recurse with class types, there's no support for type class t1 = .. and t2 = [`X ..] etc. The solution, using extra parameters and open recursion, followed by closure of the recursions, works but is vastly too messy to encode by hand if there are more than a couple of parameters needed. This really does need to be automated in the special case where you're only opening the types so you can later close them. In general, for incremental type building, you need to retain the open types.. and it isn't clear if there's any way to make it tractable (syntactically I mean). Unfortunately .. the easiest kind of solution is to write a code generator in Python or Perl .. this kind of polymorphism is not exactly desirable .. ;( Can MetaOcaml can handle this better? -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net