From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA01035 for caml-redistribution@pauillac.inria.fr; Fri, 25 Feb 2000 13:57:35 +0100 (MET) Resent-Message-Id: <200002251257.NAA01035@pauillac.inria.fr> Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA09368 for ; Thu, 24 Feb 2000 21:51:20 +0100 (MET) Received: from mail5.microsoft.com (mail5.microsoft.com [131.107.3.121]) by nez-perce.inria.fr (8.8.7/8.8.7) with SMTP id VAA03300 for ; Thu, 24 Feb 2000 21:51:18 +0100 (MET) Received: from 157.54.9.108 by mail5.microsoft.com (InterScan E-Mail VirusWall NT); Thu, 24 Feb 2000 12:51:16 -0800 (Pacific Standard Time) Received: by INET-IMC-05 with Internet Mail Service (5.5.2651.58) id ; Thu, 24 Feb 2000 12:51:15 -0800 Message-ID: <783D93998201D311B0CF00805FEAA07B7E9115@RED-MSG-42> From: Manuel Fahndrich To: "'caml-list@inria.fr'" Subject: # types and polymorphic variants Date: Thu, 24 Feb 2000 12:51:11 -0800 X-Mailer: Internet Mail Service (5.5.2651.58) Resent-From: weis@pauillac.inria.fr Resent-Date: Fri, 25 Feb 2000 13:57:35 +0100 Resent-To: caml-redistribution@pauillac.inria.fr What is the meaning of #foo, when foo is a polymorphic variant set? type foo = [`A | `B | `C] I assumed that it was the following: #foo = [<`A | `B | `C ] that is a set containing at most `A | `B | `C. In other words a subtype of foo. But consider the following example. type foo = [`A | `B | `C] let foo1 (x : #foo as 'a) = x let y1 = foo1 (`A : [`A]) let foo2 (x : [< `A | `B | `C] as 'a) = x let y2 = foo2 (`A : [`A]) The complier tells me: ocamlc -c -i ex1.ml type foo = [`A|`B|`C] val foo1 : (#foo as 'a) -> 'a val y1 : foo val foo2 : ([<`A|`B|`C] as 'a) -> 'a val y2 : [`A] The first function returns me only a foo, the second function returns me [`A] as expected. Thus my question, what exactly does #foo stand for. I do understand row variables, but the issue with the lower and upper bounds > < in variant types seems new. Is there a paper describing these? I seem to write types of the form [< `A | `B | `C] a lot. Shouldn't there be an abbreviation for those as well? Maybe #