From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id A3951BBAF for ; Mon, 28 Jun 2010 06:56:29 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Am4DAAPIJ0zRVdY2mGdsb2JhbACSe4wnCBUBAQEBAQgJDAcRIq5CggmEQS6IUwEBAwWFHwSPGQ X-IronPort-AV: E=Sophos;i="4.53,494,1272837600"; d="scan'208";a="65454802" Received: from mail-bw0-f54.google.com ([209.85.214.54]) by mail4-smtp-sop.national.inria.fr with ESMTP; 28 Jun 2010 06:56:29 +0200 Received: by bwz12 with SMTP id 12so50783bwz.27 for ; Sun, 27 Jun 2010 21:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:sender:received :in-reply-to:references:from:date:x-google-sender-auth:message-id :subject:to:content-type; bh=iFfStYf0v2t5ky5WHsh7wxn8sRhna+4v8tYMCjmDibM=; b=C2I1HN/gwZasyVVv8PgCUn1s2n33BM1YjsJmbtUqAM6AamSV7Wt2jnlJNV2wxTuLUq w91gA1zleqdMCPCH8iTj0lEz580trzLZbP4KXHFI/ba9hqHaszdyaCDw4byXR9kG1cLB jRmLpykcmJ/0JOR4VWTEMRgdmUJMJHYTGP7jg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; b=qgY5/gMP6kYVQu3dlmekTgXAwjQhEBJWc4qjsKgBpDmkPPIPNvuBWxuPvHkS1aDhhc Blw+5yVUCK8vyuICccLMiX0NEx69+v9vb6nh4rXPwZVgY1ZNF83CsOfK8/V570NltHQl Qf5pOF6/kJKmll0zRVh4OdoS5NK7p/SINbSjM= Received: by 10.204.134.84 with SMTP id i20mr1119250bkt.209.1277700988759; Sun, 27 Jun 2010 21:56:28 -0700 (PDT) MIME-Version: 1.0 Sender: gabriel.scherer@gmail.com Received: by 10.204.68.148 with HTTP; Sun, 27 Jun 2010 21:56:08 -0700 (PDT) In-Reply-To: <20100628021543.GA14360@malaquias.DHCP-GERAL> References: <20100628021543.GA14360@malaquias.DHCP-GERAL> From: bluestorm Date: Mon, 28 Jun 2010 06:56:08 +0200 X-Google-Sender-Auth: 7a5muThqEhePYmrYrhEY1-X0aO4 Message-ID: Subject: Re: [Caml-list] Symbol type To: caml-list@inria.fr Content-Type: multipart/alternative; boundary=0015174c1e86906d5c048a0ff111 X-Spam: no; 0.00; variants:01 foo:01 foo:01 variants:01 polymorphic:01 polymorphic:01 caml-list:01 functions:01 functions:01 variant:02 variant:02 define:02 define:02 caml:02 caml:02 --0015174c1e86906d5c048a0ff111 Content-Type: text/plain; charset=ISO-8859-1 If your set of symbol is closed, you can use a variant type (sum type). type symbols = | A | B If you really need open symbols, you can use [polymorphic variants]. Let tag_a foo = (`A, foo) [polymorphic variants] http://caml.inria.fr/pub/docs/manual-ocaml/manual006.html#toc36 However, you won't have convenience functions such as string_of_symbol; you would have to define them yourself. --0015174c1e86906d5c048a0ff111 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable If your set of symbol is closed, you can use a variant type (sum type).
type symbols =3D
| A
| B

=

If you really need open symbols, you can use [pol= ymorphic variants].

Let tag_a foo =3D (`A, foo)



However, you won't have convenience = functions such as string_of_symbol; you would have to define them yourself.=
--0015174c1e86906d5c048a0ff111--