[
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: | -- (:) |
| From: | briand@a... |
| Subject: | mutually recursive classes (yes - again) |
I've read the other threads on this common subject and I am not getting understanding. So I present the following very simple example with the hopes that some kind person will help. The definition is very simple making use of the "and" keyword class type a1 = object val a:a1 val b:a2 end and a2 object val c:a2 val d:a1 end ;; It's the implementation which gives me trouble. And yes there is an example in the manual (3.15) and it just doesn't go quite far enough... now I have to define the clases class a1 (x:a1) (y:a2) = object val a = x val b = y end ;; class a2 (x:a2) (y:a1) = object val c = x val d = y end ;; So now let z1 = new a1 ?? ?? ;; let z2 = new a2 ?? ?? ;; Obviously I need to "ground" the recursion somehow, but without some sort of "Null" or "Void" value to use to instantiate the a1 field of a1 it's not obvious to me how to do it. I'm sure it will be embarassingly simple ... I have about 7 more classes in this recursion-fest and a nice orderly way to handle it would be VERY helpful. TIA. Brian