Version française
Home     About     Download     Resources     Contact us    
Browse thread
What does underscore mean in this type expression?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] What does underscore mean in this type expression?
On Sat, Aug 30, 2008 at 01:38:31PM +0200, Christophe TROESTLER wrote:
> On Sat, 30 Aug 2008 12:27:18 +0100, Richard Jones wrote:
> > 
> >     val get_domains :
> >       (_[> `R ] as 'a) Connect.t ->
> >   is not included in
> >     val get_domains :
> >       ([> `R ] as 'a) Connect.t ->
> > 
> > This syntax doesn't appear to be documented in the manual (unless it's
> > related to '_a).  What does it mean?
> 
> It is a weak type as you guessed.  To convince you of that, here is
> some code:
> 
> # let x = ref `X;;
> val x : _[> `X ] ref = {contents = `X}

OK ... so how to get rid of the error?  Even supplying a full type for
get_domains in the implementation doesn't get rid of it.

Here's the code if anyone wishes to try:

  http://www.annexia.org/tmp/libvirt.mli
  http://www.annexia.org/tmp/libvirt.ml

  $ ocamlc -c libvirt.mli
  $ ocamlc -c libvirt.ml
  The implementation libvirt.ml does not match the interface libvirt.cmi:
  Values do not match:
  [etc]

Rich.

-- 
Richard Jones
Red Hat