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
[Caml-list] Polymorphic variant abbreviations
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-09-19 (08:37)
From: Laurent Vibert <lvibert@i...>
Subject: Re: [Caml-list] Polymorphic variant abbreviations
On Tue, 18 Sep 2001, Patrick M Doane wrote:

> (* The first works as I would expect, the second gives a very unexpected
> type. There seems to be some kind of unexpected unification going on
> between terms. *)
> let h1 (#b as x1) (#c as x2) = `A [x1; x2]

here #b is a pattern, it is the same as
let h1 (`B as x1) (`C as x2) = `A [x1; x2]

> let h2 (x1 : #b) (x2 : #c) = `A [x1; x2]

but here it is a type expression, and is the same as
let h2 (x1 : [< `B]) (x2 : [< `C]) = `A [x1; x2]

and in a list, all argument must have the same type, tou take the
intersection of both and obtain [ ]

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