Version française
Home     About     Download     Resources     Contact us    
Browse thread
Poly variants
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] Poly variants
From: Yaron Minsky <yminsky@gmail.com>

> Egad!  I wish someone had announced this!  Our code uses all sorts of
> lower-case variants.  Is there a serious possibility of this going
> away?  And if so, why?  And if so, wouldn't a warning of some kind
> have been appropriate?
>
> > http://caml.inria.fr/ocaml/htmlman/manual011.html
> > 
> > Note on variant tags: the current implementation accepts lowercase
> > variant tags in addition to uppercase variant tags, but we suggest you
> > avoid lowercase variant tags for portability and compatibility with
> > future OCaml versions.

The reason lower-case are left in the compiler is historical.
It was decided that in ocaml 3 variants shall all be upper-case,
but in ocaml 2.99 lower-case was still allowed for compatibility with
libraries imported from Objective Label.
Then I completely forgot to remove them from the compiler, and by the
time we realised that this was not conform to the spec (ocaml 3.02 or
later) it was a bit late to make a sudden change.

So the situation is that the implementation is not conform to the
specification, but there is no plan to change the implementation as
this is not a dangerous problem. Maybe the specification will change
in ocaml 4 (if it happens).

By the way, here are the pros and cons
* Pro lowercase: personally I tend to use them for phantom types, to
   make clear these tags are not values. Others might have other
   meanings for them.
* Por uppercase only: some find it more coherent. Also this allows one
   more kind of identifiers (i.e. backquote + lowercase), if we
   desperately need them for another use.

Jacques Garrigue