From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 945ABBBAF for ; Mon, 31 May 2010 17:54:41 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AugBALJ4A0yCcYARmWdsb2JhbACDGI5ljEsBAQEBAQgLCgcRIrAXkE6BJoMFawQ X-IronPort-AV: E=Sophos;i="4.53,334,1272837600"; d="scan'208";a="60347452" Received: from coriana6.cis.mcmaster.ca ([130.113.128.17]) by mail1-smtp-roc.national.inria.fr with ESMTP; 31 May 2010 17:54:40 +0200 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 o4VFsQaE004958; Mon, 31 May 2010 11:54:38 -0400 (EDT) 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 o4VFsDUe028975; Mon, 31 May 2010 11:54:13 -0400 Received: from [129.97.169.240] (account carette@univmail.cis.mcmaster.ca [129.97.169.240] verified) by cgpsrv2.cis.mcmaster.ca (CommuniGate Pro SMTP 5.2.12) with ESMTPSA id 304639251; Mon, 31 May 2010 11:54:14 -0400 Message-ID: <4C03DBA6.8020208@mcmaster.ca> Date: Mon, 31 May 2010 11:54:14 -0400 From: Jacques Carette User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Till Varoquaux Cc: caml-list@inria.fr Subject: Re: [Caml-list] Why is this allowed? References: <4C03CBD3.3010606@mcmaster.ca> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version-Mac: 5.5.9.395186, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2010.5.31.154515 X-PerlMx-Spam: Gauge=XXXXXXXXII, Probability=82%, Report=' FREEWEB_GROUPS_YAHOO_COM 8, KNOWN_FREEWEB_URI 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, ECARD_KNOWN_DOMAINS 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __KNOWN_FREEWEB_URI3 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MOZILLA_MSGID 0, __SANE_MSGID 0, __URI_NO_WWW 0, __USER_AGENT 0' X-Spam-Flag: NO X-Spam: no; 0.00; 'problem':01 ocaml:01 serialize:01 arbitrarily:01 metaocaml:01 oleg:01 afaik:01 foo:01 struct:01 foo:01 struct:01 metaocaml:01 beginner's:01 ocaml:01 bug:01 Nice trick - but my 'problem' [1] regards arbitrary valid OCaml code and how to serialize code values. The issue seems to be that one needs to attach an arbitrarily large typing environment to each part of a value, as there is no global typing environment which will do the job (because of shadowing). Jacques [1] Actually 'our' problem, in that this arose from some issues in metaocaml, and I am working with Oleg to figure out what is going on. Interestingly, this never arose in 3.09 and before. Till Varoquaux wrote: > AFAIK you are allowed to shadow just about anything in > implementations. If you wanted to keep the exact same interface but > retain the ability to avvoid the shadowing issue on the labels you > could do: > > module Foo = struct > type t = Foo > end > type foo = Foo.t = Foo > > module Foo2 = struct > type t = Foo | Bar > end > > type foo2 = Foo2.t = Foo | Bar > > HTH, > Till > > On Mon, May 31, 2010 at 10:46 AM, Jacques Carette wrote: > >> type foo = Foo >> let x = Foo >> >> type foo2 = Foo | Bar >> let y = Foo >> let z = (x,y) ;; >> >> I thought that re-using of algebraic labels was not allowed - but apparently >> it is? Note that this means that it is impossible to "text" print such >> structures and hope to recover them uniquely. This also causes very subtle >> issues when Marshal'ing, and grave issues for code generation [think >> metaocaml]. >> >> Jacques >> >> _______________________________________________ >> Caml-list mailing list. Subscription management: >> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list >> Archives: http://caml.inria.fr >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs >> >> > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >