caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Polymorphic Variants and Objects
@ 2001-12-18 14:37 Jim Farrand
  2001-12-20  2:07 ` Jacques Garrigue
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Farrand @ 2001-12-18 14:37 UTC (permalink / raw)
  To: caml-list


Take a look at the following OCaml class type definition:

class type foo =
  object
    method bar: [ `A | `B ] 
  end

I want to be able to relax the type of bar so that it can return any variant 
tag, rather than being limited to `A or `B.

Is this possible?  I tried

class type foo =
  object
    method bar: [> ] 
  end

but this is rejected on the grounds that

The method bar has type [> ] where .. is unbound

Any suggestions?

Regards,
Jim
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

end of thread, other threads:[~2001-12-20  9:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-18 14:37 [Caml-list] Polymorphic Variants and Objects Jim Farrand
2001-12-20  2:07 ` Jacques Garrigue
2001-12-20  9:44   ` Jim Farrand

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).