English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2008-03-24 (03:16)
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!