Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
recursive types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Le Normand <rathereasy@g...>
Subject: recursive types
hello again list
is it possible to have mutually recursive classes and types? I'm trying to
implement the zipper, and this is what I came up with:

class type node_wrapper =
  method identify : string
  method get_child_location : location

class virtual nodeable =
  method virtual to_node_wrapper : node_wrapper

type path = (nodeable list * location * nodeable list) option
and location = Loc of nodeable * path

which, of course, doesn't type check

a simpler test case would be

class a =
  val b : c

type c = a

thanks for all the help so far!