From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 420F5BBAF; Tue, 20 Jan 2009 19:04:49 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: As0AAOagdUmCcYARnGdsb2JhbACUBwEBAQEBCAsICRG3dIVz X-IronPort-AV: E=Sophos;i="4.37,295,1231110000"; d="scan'208";a="22798216" Received: from coriana6.cis.mcmaster.ca ([130.113.128.17]) by mail1-smtp-roc.national.inria.fr with ESMTP; 20 Jan 2009 19:04:47 +0100 Received: from Dura7.UTS.McMaster.CA (dura7.UTS.mcmaster.ca [130.113.196.62]) by coriana6.cis.mcmaster.ca (8.13.7/8.13.7) with ESMTP id n0KI4aFD003297; Tue, 20 Jan 2009 13:04:45 -0500 (EST) Received: from cgpsrv2.cis.mcmaster.ca (univmail.CIS.McMaster.CA [130.113.64.46]) by Dura7.UTS.McMaster.CA (8.13.7/8.13.7) with ESMTP id n0KI4CAh002430; Tue, 20 Jan 2009 13:04:12 -0500 Received: from [129.97.84.95] (account carette@univmail.cis.mcmaster.ca HELO [192.168.1.109]) by cgpsrv2.cis.mcmaster.ca (CommuniGate Pro SMTP 4.3.12) with ESMTPSA id 239326449; Tue, 20 Jan 2009 13:04:12 -0500 Message-ID: <4976121B.3040109@mcmaster.ca> Date: Tue, 20 Jan 2009 13:04:11 -0500 From: Jacques Carette User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Luc Maranget Cc: caml-list@inria.fr Subject: Re: [Caml-list] polymorphic variants, long form References: <49760BBF.7090008@mcmaster.ca> <20090120173958.GA24589@yquem.inria.fr> In-Reply-To: <20090120173958.GA24589@yquem.inria.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version-Mac: 5.4.2.338381, Antispam-Engine: 2.6.0.325393, Antispam-Data: 2009.1.20.174914 X-PerlMx-Spam: Gauge=IIIIIII, Probability=7%, Report='BODY_SIZE_1000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_600_699 0, __BOUNCE_CHALLENGE_SUBJ 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __USER_AGENT 0' X-Spam: no; 0.00; variants:01 maranget:01 struct:01 foo:01 foo:01 syntax:01 'foo:01 ocaml:01 variants:01 polymorphic:01 polymorphic:01 wrote:01 luc:01 caml-list:01 int:01 Luc Maranget wrote: >> What is the proper 'long name' of a polymorphic variant? >> module S = struct type a = [`Foo of int] end >> >> How do I refer to `Foo without opening S? Both S.`Foo and `S.Foo are >> syntax errors. >> >> Jacques >> > > 'Foo does the job, it does not refer to any previous type definition. > > % ocaml > Objective Caml version 3.11.0 > > # `Foo;; > - : [> `Foo ] = `Foo > Just a few minutes after I sent my email, I remembered the answer myself: unlike normal variants, polymorphic variants are not scoped but affect the namespace in a GLOBAL way. Both extremely convenient and non-modular at the same time. Jacques