caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Question about O'Caml 3
@ 2000-04-27 12:16 Thorsten Ohl
  2000-04-28  0:52 ` Jacques Garrigue
  2000-04-28  2:10 ` O'Caml 3 doco John Max Skaller
  0 siblings, 2 replies; 4+ messages in thread
From: Thorsten Ohl @ 2000-04-27 12:16 UTC (permalink / raw)
  To: caml-light; +Cc: caml-list

Contrary to the documentation, O'Caml 3.00 accepts, lowercase
identifiers for polymorphic variants.

ohl@heplix4:~Mail$ ocaml
        Objective Caml version 3.00

# `foo;;
- : [> `foo] = `foo

Who's right: the compiler or the manual?

BTW: the new syntax for labels is very readable.  Congratulations.
 
Cheers,
-Thorsten
-- 
Thorsten Ohl, Physics Department, TU Darmstadt -- ohl@hep.tu-darmstadt.de
http://heplix.ikp.physik.tu-darmstadt.de/~ohl/ [<=== PGP public key here]




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

* Re: Question about O'Caml 3
  2000-04-27 12:16 Question about O'Caml 3 Thorsten Ohl
@ 2000-04-28  0:52 ` Jacques Garrigue
  2000-04-28 10:00   ` Thorsten Ohl
  2000-04-28  2:10 ` O'Caml 3 doco John Max Skaller
  1 sibling, 1 reply; 4+ messages in thread
From: Jacques Garrigue @ 2000-04-28  0:52 UTC (permalink / raw)
  To: ohl; +Cc: caml-list

From: Thorsten Ohl <ohl@hep.tu-darmstadt.de>

> Contrary to the documentation, O'Caml 3.00 accepts, lowercase
> identifiers for polymorphic variants.
> 
> ohl@heplix4:~Mail$ ocaml
>         Objective Caml version 3.00
> 
> # `foo;;
> - : [> `foo] = `foo
> 
> Who's right: the compiler or the manual?

Well, we were so busy discussing label syntax that this point was not
debated before 3.00.
The current answer is: both are correct.

If you want to be on the safe side, better not to use lowercase
variants, since they could be removed in the future.
Also they are probably not so nice if you are really intending to use
them as sum types, which are usually identified by their uppecase
first letter.
On the other hand, I have a personal liking for lowercase variants, at
least when they have only an abstract meaning (not really used as
values, but rather as types, and types are lowercase).

Some libraries, namely lablGL and lablGTK (only internally for
lalblGTK), actually use lowercase labels, so I prefered to keep them
for now in the compiler, as they are not harmful, rather than having
to correct everything before a real decision is taken.

---------------------------------------------------------------------------
Jacques Garrigue      Kyoto University     garrigue at kurims.kyoto-u.ac.jp
		<A HREF=http://wwwfun.kurims.kyoto-u.ac.jp/~garrigue/>JG</A>




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

* O'Caml 3 doco
  2000-04-27 12:16 Question about O'Caml 3 Thorsten Ohl
  2000-04-28  0:52 ` Jacques Garrigue
@ 2000-04-28  2:10 ` John Max Skaller
  1 sibling, 0 replies; 4+ messages in thread
From: John Max Skaller @ 2000-04-28  2:10 UTC (permalink / raw)
  Cc: caml-list

There's another glitch in the ocaml 3.00 documentation:
it says that 'of' is elided in polymorphic variants.
This was the case in 2.99 but has been changed in 3.00.

-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net




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

* Re: Question about O'Caml 3
  2000-04-28  0:52 ` Jacques Garrigue
@ 2000-04-28 10:00   ` Thorsten Ohl
  0 siblings, 0 replies; 4+ messages in thread
From: Thorsten Ohl @ 2000-04-28 10:00 UTC (permalink / raw)
  To: Jacques Garrigue; +Cc: ohl, caml-list

Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp> writes:

> If you want to be on the safe side, better not to use lowercase
> variants, since they could be removed in the future.  Also they are
> probably not so nice if you are really intending to use them as sum
> types, which are usually identified by their uppecase first letter.
> On the other hand, I have a personal liking for lowercase variants,
> at least when they have only an abstract meaning (not really used as
> values, but rather as types, and types are lowercase).

When ocaml-2.99 came out I tried to pick up idioms with polymorphic
variants from the lablgtk sources and I was very confused by this
ambiguity.

As you said, the lowercase polymorphic variants appeared to be used
more like types and the uppercase polymorphic variants appeared to be
usd more like sum types.  However, the lowercase polymorphic variants
were not mentioned anywhere ... 

>From the compiler sources, I then found out that there is no
difference and assumed (apparently correctly) that they are there for
olabl compatibility.

I'm not complaining about lack of documentation, but I want to point
out that such ambiguities make it hard for novices (it's my fault,
that I hadn't studied olabl before, of course) to pick up proper
idioms in a programming language.

Cheers,
-Thorsten
-- 
Thorsten Ohl, Physics Department, TU Darmstadt -- ohl@hep.tu-darmstadt.de
http://heplix.ikp.physik.tu-darmstadt.de/~ohl/ [<=== PGP public key here]




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

end of thread, other threads:[~2000-04-28 10:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-27 12:16 Question about O'Caml 3 Thorsten Ohl
2000-04-28  0:52 ` Jacques Garrigue
2000-04-28 10:00   ` Thorsten Ohl
2000-04-28  2:10 ` O'Caml 3 doco John Max Skaller

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).