[
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: | 2009-01-20 (18:04) |
From: | Jacques Carette <carette@m...> |
Subject: | Re: [Caml-list] polymorphic variants, long form |
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