caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Mutual recursion between classes and types in OCaml
@ 2003-06-21 14:55 Anton Lavrik
  2003-06-23  1:14 ` Jacques Garrigue
  0 siblings, 1 reply; 2+ messages in thread
From: Anton Lavrik @ 2003-06-21 14:55 UTC (permalink / raw)
  To: caml-list


Hi,

I suppose it's quite useful to define object types and "ordinary" types, so
that they could refer to each other. For example,

	class c = 
	object val v = A 0	(* constructor `A' is not bound *)
	end 

	[...] (* some syntactic construct like `and' keyword *)

	type t = A of int | B of c (* now type `t' and constructor `A' are
	defined *)
	
	
It is possible to mix these two type definition forms in sequential order.
And AFAIK it's not possible to define types like in the example above,
at least in direct manner (however one can use polymorphic classes and
virtualization to achieve analogous results, but this is very
inconvenient in general).

So why mutual recursion between classes and types is not allowed? Is this
fundamental or technical problem? I can't find any references denoting that
problem.

BTW, what does `-rectypes' ocamlc's option really mean (there are quite a
few words about it in reference manual)? And how does it concern the
subject?

-- 
Regards, Anton.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-06-23  1:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-21 14:55 [Caml-list] Mutual recursion between classes and types in OCaml Anton Lavrik
2003-06-23  1:14 ` Jacques Garrigue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).