Browse thread
Why is this allowed?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2010-05-31 (15:54) |
From: | Jacques Carette <carette@m...> |
Subject: | Re: [Caml-list] Why is this allowed? |
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 <carette@mcmaster.ca> 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 >