caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Poly variants
@ 2004-12-17 18:24 Christophe TROESTLER
  2004-12-17 18:45 ` [Caml-list] " Tiago Dionizio
  0 siblings, 1 reply; 11+ messages in thread
From: Christophe TROESTLER @ 2004-12-17 18:24 UTC (permalink / raw)
  To: O'Caml Mailing List

Hi,

        Objective Caml version 3.08.2
# `a;;
- : [> `a ] = `a

Is the lack of capitalisation in the tag-name really wanted?

ChriS


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] Poly variants
  2004-12-17 18:24 Poly variants Christophe TROESTLER
@ 2004-12-17 18:45 ` Tiago Dionizio
  2004-12-17 19:05   ` Christophe TROESTLER
  2004-12-17 19:30   ` Yaron Minsky
  0 siblings, 2 replies; 11+ messages in thread
From: Tiago Dionizio @ 2004-12-17 18:45 UTC (permalink / raw)
  To: Christophe TROESTLER; +Cc: O'Caml Mailing List

On Fri, 17 Dec 2004 19:24:13 +0100 (CET), Christophe TROESTLER
<Christophe.Troestler@umh.ac.be> wrote:
> Hi,
> 
>         Objective Caml version 3.08.2
> # `a;;
> - : [> `a ] = `a
> 
> Is the lack of capitalisation in the tag-name really wanted?

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.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] Poly variants
  2004-12-17 18:45 ` [Caml-list] " Tiago Dionizio
@ 2004-12-17 19:05   ` Christophe TROESTLER
  2004-12-18  1:04     ` skaller
  2004-12-17 19:30   ` Yaron Minsky
  1 sibling, 1 reply; 11+ messages in thread
From: Christophe TROESTLER @ 2004-12-17 19:05 UTC (permalink / raw)
  To: caml-list

On Fri, 17 Dec 2004, Tiago Dionizio <tngd81@gmail.com> wrote:
> 
> On Fri, 17 Dec 2004 19:24:13 +0100 (CET), Christophe TROESTLER
> <Christophe.Troestler@umh.ac.be> wrote:
> > Hi,
> > 
> >         Objective Caml version 3.08.2
> > # `a;;
> > - : [> `a ] = `a
> > 
> > Is the lack of capitalisation in the tag-name really wanted?
> 
> 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.

Thanks, I read too fast ;) -- hopefully this will be removed soon.

ChriS


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] Poly variants
  2004-12-17 18:45 ` [Caml-list] " Tiago Dionizio
  2004-12-17 19:05   ` Christophe TROESTLER
@ 2004-12-17 19:30   ` Yaron Minsky
  2004-12-17 19:43     ` Christophe TROESTLER
                       ` (2 more replies)
  1 sibling, 3 replies; 11+ messages in thread
From: Yaron Minsky @ 2004-12-17 19:30 UTC (permalink / raw)
  To: Tiago Dionizio; +Cc: Christophe TROESTLER, O'Caml Mailing List

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?

y


On Fri, 17 Dec 2004 18:45:23 +0000, Tiago Dionizio <tngd81@gmail.com> wrote:
> On Fri, 17 Dec 2004 19:24:13 +0100 (CET), Christophe TROESTLER
> <Christophe.Troestler@umh.ac.be> wrote:
> > Hi,
> >
> >         Objective Caml version 3.08.2
> > # `a;;
> > - : [> `a ] = `a
> >
> > Is the lack of capitalisation in the tag-name really wanted?
> 
> 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.
> 
> _______________________________________________
> 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
>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] Poly variants
  2004-12-17 19:30   ` Yaron Minsky
@ 2004-12-17 19:43     ` Christophe TROESTLER
  2004-12-17 20:11       ` Yaron Minsky
  2004-12-17 22:50     ` Damien Doligez
  2004-12-18  1:29     ` Jacques Garrigue
  2 siblings, 1 reply; 11+ messages in thread
From: Christophe TROESTLER @ 2004-12-17 19:43 UTC (permalink / raw)
  To: yminsky, yminsky, caml-list

On Fri, 17 Dec 2004, Yaron Minsky <yminsky@gmail.com> wrote:
> 
> 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?

See e.g. http://citeseer.ist.psu.edu/appel92critique.html section 3,
page 12.  Other will certainly have more to say.  (My original post
was motivated by hitting such a "bug".)

Cheers,
ChriS


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] Poly variants
  2004-12-17 19:43     ` Christophe TROESTLER
@ 2004-12-17 20:11       ` Yaron Minsky
  2004-12-17 21:00         ` Christophe TROESTLER
  0 siblings, 1 reply; 11+ messages in thread
From: Yaron Minsky @ 2004-12-17 20:11 UTC (permalink / raw)
  To: Christophe TROESTLER; +Cc: caml-list

On Fri, 17 Dec 2004 20:43:48 +0100 (CET), Christophe TROESTLER
<Christophe.Troestler@umh.ac.be> wrote:
> On Fri, 17 Dec 2004, Yaron Minsky <yminsky@gmail.com> wrote:
> >
> > 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?
> 
> See e.g. http://citeseer.ist.psu.edu/appel92critique.html section 3,
> page 12.  Other will certainly have more to say.  (My original post
> was motivated by hitting such a "bug".)

I don't think the critique applies.  Variant types can be
distinguished by the leading tick.  Why do they need to be uppercased
as well?  I suppose it would provide some extra visual uniformity with
ordinary variant types, but it hardly seems worth breaking existing
code for that.

y


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] Poly variants
  2004-12-17 20:11       ` Yaron Minsky
@ 2004-12-17 21:00         ` Christophe TROESTLER
  2004-12-17 21:36           ` Yaron Minsky
  0 siblings, 1 reply; 11+ messages in thread
From: Christophe TROESTLER @ 2004-12-17 21:00 UTC (permalink / raw)
  To: yminsky, yminsky; +Cc: caml-list

On Fri, 17 Dec 2004, Yaron Minsky <yminsky@gmail.com> wrote:
> 
> I don't think the critique applies.  Variant types can be
> distinguished by the leading tick.  Why do they need to be
> uppercased as well?  I suppose it would provide some extra visual
> uniformity with [...]

I agree -- I personally would wish that the back tick only
distinguishes between normal and polymorphic variant constructors.

ChriS


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] Poly variants
  2004-12-17 21:00         ` Christophe TROESTLER
@ 2004-12-17 21:36           ` Yaron Minsky
  0 siblings, 0 replies; 11+ messages in thread
From: Yaron Minsky @ 2004-12-17 21:36 UTC (permalink / raw)
  To: Christophe TROESTLER; +Cc: caml-list

On Fri, 17 Dec 2004 22:00:16 +0100 (CET), Christophe TROESTLER
<Christophe.Troestler@umh.ac.be> wrote:
> On Fri, 17 Dec 2004, Yaron Minsky <yminsky@gmail.com> wrote:
> >
> > I don't think the critique applies.  Variant types can be
> > distinguished by the leading tick.  Why do they need to be
> > uppercased as well?  I suppose it would provide some extra visual
> > uniformity with [...]
> 
> I agree -- I personally would wish that the back tick only
> distinguishes between normal and polymorphic variant constructors.

More like we disagree...  I see the point, but it seems fairly trivial
compared to breaking existing code.  I vote nay to the change. 
(luckily, ocaml is not a democracy.)

y


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] Poly variants
  2004-12-17 19:30   ` Yaron Minsky
  2004-12-17 19:43     ` Christophe TROESTLER
@ 2004-12-17 22:50     ` Damien Doligez
  2004-12-18  1:29     ` Jacques Garrigue
  2 siblings, 0 replies; 11+ messages in thread
From: Damien Doligez @ 2004-12-17 22:50 UTC (permalink / raw)
  To: O'Caml Mailing List

On 17 déc. 2004, at 20:30, Yaron Minsky wrote:

> 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?

Don't worry.  If we ever decide to remove it, we'll start by adding a
warning to the compiler, then keep the feature for (at least) several
more years before we remove it.

-- Damien


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] Poly variants
  2004-12-17 19:05   ` Christophe TROESTLER
@ 2004-12-18  1:04     ` skaller
  0 siblings, 0 replies; 11+ messages in thread
From: skaller @ 2004-12-18  1:04 UTC (permalink / raw)
  To: Christophe TROESTLER; +Cc: caml-list

On Sat, 2004-12-18 at 06:05, Christophe TROESTLER wrote:
> On Fri, 17 Dec 2004, Tiago Dionizio <tngd81@gmail.com> wrote:
> > 
> > On Fri, 17 Dec 2004 19:24:13 +0100 (CET), Christophe TROESTLER
> > <Christophe.Troestler@umh.ac.be> wrote:
> > > Hi,
> > > 
> > >         Objective Caml version 3.08.2
> > > # `a;;
> > > - : [> `a ] = `a
> > > 
> > > Is the lack of capitalisation in the tag-name really wanted?
> > 
> > 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.
> 
> Thanks, I read too fast ;) -- hopefully this will be removed soon.

Why? Capitalisation is a really nasty hack, to get around
the lack of characters in the ASCII character set.

The idea is also seriously incompatible with
an i18n version of Ocaml, which should follow
ISO Standards with respect to acceptable identifiers:
these include letters from many human languages,
some of which lack any concept of capitalisation.

I went to some trouble in Felix to avoid this bug.
All 'names' can use any 'unicode' letter.
There is a price -- in Felix patterns you can see

	match x with | ctor ?v => ...

a ? is needed to distinguish variables from
constructors.

Polymorphic variants use lead ` character, so don't suffer
from this capitalisation hack.

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Caml-list] Poly variants
  2004-12-17 19:30   ` Yaron Minsky
  2004-12-17 19:43     ` Christophe TROESTLER
  2004-12-17 22:50     ` Damien Doligez
@ 2004-12-18  1:29     ` Jacques Garrigue
  2 siblings, 0 replies; 11+ messages in thread
From: Jacques Garrigue @ 2004-12-18  1:29 UTC (permalink / raw)
  To: yminsky; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-12-18  1:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-17 18:24 Poly variants Christophe TROESTLER
2004-12-17 18:45 ` [Caml-list] " Tiago Dionizio
2004-12-17 19:05   ` Christophe TROESTLER
2004-12-18  1:04     ` skaller
2004-12-17 19:30   ` Yaron Minsky
2004-12-17 19:43     ` Christophe TROESTLER
2004-12-17 20:11       ` Yaron Minsky
2004-12-17 21:00         ` Christophe TROESTLER
2004-12-17 21:36           ` Yaron Minsky
2004-12-17 22:50     ` Damien Doligez
2004-12-18  1:29     ` Jacques Garrigue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).