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
Merging object signatures
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-11-05 (14:45)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] Merging object signatures
On 2010/11/05, at 21:58, Dario Teixeira wrote:
>> Can't you make foo_t and bar_t class types and foobar_t inherits them
>> both?
> Thanks for the reply.  Yes, in the toy example I posted that would indeed
> be an alternative.  Still, I'm wondering about the most general case;
> suppose I had a function that took an object satisfying both foo_t and bar_t:
> val do_something: < foo_t; bar_t; .. > -> bool
> This is what I'm wondering if it's possible to express.

Same thing:

  class type foobar_t = object inherit foo_t inherit bar_t end
  val do_something : #foobar_t -> bool

I agree that this is rather verbose.
I thought a few times of adding the syntax you propose, but was always
stopped by the fact you can already do it in a verbose way.

Jacques Garrigue