caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gerd Stolpmann <gerd@gerd-stolpmann.de>
To: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>,
	Jean-Christophe.Filliatre@lri.fr, orodeh@cs.huji.ac.il
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Future of labels, and ideas for library labelling
Date: Wed, 4 Apr 2001 21:18:18 +0200	[thread overview]
Message-ID: <01040422370105.00489@ice> (raw)
In-Reply-To: <20010403230626W.garrigue@kurims.kyoto-u.ac.jp>

On Tue, 03 Apr 2001, Jacques Garrigue wrote:
>Last message before I make a needed pause, since I think lots of
>people are already discarding this thread anyway.

As I saw that many messages, I skipped the thread first. But I know it's
important... Sometimes it is better to wait until the direction of the
discussion becomes clearer.

I must admit that I never _decided_ whether to use classic mode or label mode;
I had my code base, and when O'Caml 3 was introduced I took the simplest way to
maintain my code. That was classic mode, because labels mode was incompatible
to previous versions of O'Caml. I began to use optional arguments, and from
time to time I also assigned labels to non-optional arguments. Even more seldom
I wrote labels at applications. (I _am_ an incremental learner.)

So I am a 50% classic mode user. 50% because I think labels are useful in
signatures (as documentation), but I can live without labels in
implementations. In my opinion, a (non-optional) "labels are comments in
signatures" mode would be right (i.e. nolabel mode). However, there is an
argument against this type of nolabel mode.

As a "library provider" I see the following problem with such a mode (and with
the current classic mode, too): I'm sometimes assigning too many labels, as in:

val f : ?optional:s -> nonoptional:t -> u

This is very natural if your main intention is documentation. But:

In classic and nolabels mode, the ~optional argument is really optional
because you don't apply the ~nonoptional argument with a label. But in labels
mode, you must pass the optional argument in order to execute the function.
Okay, the compiler prints warnings in such cases, but as a classic/nolabel
user I can ignore them. So I fear that libraries provided by users such me tend
to have pitfalls for labels users.

Because of this, I suggest that the compiler enforces that non-optional
labels are either turned on or off: If the .ml file is compiled with labels
turned off, the .mli file must not contain labels. If the .ml file is compiled
in label mode, it is accepted that the .mli file contains labels. So I am no
longer allowed to mix labeled declarations/definitions and unlabeled
applications in an insane manner.

Note that it is still possible to _use_ a labeled library in nolabel mode; in
this case all the labels are ignored.

>I just repeat here what was my last proposal, since it was in the
>middle of a mail, and some interested people may have not read it.
>At least, they don't seem to have read it.
>(It's only a personal idea.)
>
>* make label mode the default mode

Which mode is the default is very important. Users tend to keep the default
mode; so this mode will be used more frequent than the other mode. However, I
think we should not discuss about this point politically (i.e. who wins the
default mode wins the battle). Only a remark...

>* keep a nolabel mode similar to current classic mode, but not
>  allowing non-optional labels in function calls

As I already explained, I suggest to disallow non-optional labels in
abstractions and in signatures, too. This ensures that a library
written in any of both modes can be used in programs using the other mode in a
sane way.

>* remove all labels from the standard library

The standard library can remain labeled, because a nolabel user sees a view of
the standard library where all non-optional labels are stripped. But the stdlib
must itself be written in label mode.

>* introduce a module StdLabels containing labelized versions of List
>  and Array for labellers
>* add some extra labelized versions of a few functions: 
>  Pervasives.output', Pervasives.input', Pervasives.really_input',
>  Array.blit', String.blit'
>  and maybe also String.sub', String.fill', Buffer.add_substring',
>  Hashtbl.add', Map.add'.

This looks very ugly. 

>Remark that this does not change anything for people who didn't use
>labels before: label mode is a conservative extension of ocaml 2, so
>you don't even need to use the nolabel mode.

Fully agreed.

To summarize my suggestion:

- Two modes as before, but with clear roles: 
  - nolabels mode: Non-optional labels are totally forbidden. Neither
    abstractions nor applications nor mli files must contain labels. Optional
    labels are possible. When calling a library written in label mode, the
    arguments are identified by position nevertheless.

  - labels mode: Can remain as it is.

- Standard library: Is written in label mode, and has a labeled signature.

- Default mode: Is the nolabels mode because this mode is backward-compatible
  to O'Caml 2 and all 0% classic mode users (those who never use labels in
  their own abstractions nor in applications)

I think most current classic mode users can live with this. The difference
between these nolabels and labels modes is bigger than in the current
version of the language, as both modes emphasize their view on argument
handling. This may motivate people to switch from nolabels to labels mode,
because there is a real benefit from it. (You get the labels only if you
switch, even if your motivation for labels is code documentation and not the
possibility of commutation.)

A last thought: The nolabels mode should be called positional mode; "nolabels"
sounds very negative and one may associate with this name that its support will
end in the near future. (I also thought about a better name for label mode
because many people on the list were confused from the fact that it only changes
the meaning of non-optional labels. "Commuting non-optional labels mode" is too
long. But renaming the classical mode has an impact on that, too.)

Gerd
-- 
----------------------------------------------------------------------------
Gerd Stolpmann      Telefon: +49 6151 997705 (privat)
Viktoriastr. 100             
64293 Darmstadt     EMail:   gerd@gerd-stolpmann.de
Germany                     
----------------------------------------------------------------------------
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


  parent reply	other threads:[~2001-04-05 17:42 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-31  3:40 [Caml-list] Future of labels Yaron M. Minsky
2001-04-02  3:39 ` [Caml-list] Future of labels, and ideas for library labelling Jacques Garrigue
2001-04-02  7:58   ` Judicael Courant
2001-04-02  8:50     ` Markus Mottl
2001-04-02 10:33     ` kahl
2001-04-03  0:35       ` Jacques Garrigue
2001-04-03  1:36         ` Kipton M Barros
2001-04-03  1:52         ` Patrick M Doane
2001-04-03  3:53           ` Jacques Garrigue
2001-04-03  5:10             ` Patrick M Doane
2001-04-03  9:30               ` Jacques Garrigue
2001-04-03  8:52             ` Xavier Leroy
2001-04-03  9:34               ` Judicael Courant
2001-04-03  9:54               ` Jacques Garrigue
2001-04-03 12:59                 ` Jean-Christophe Filliatre
2001-04-03 13:11                   ` [Caml-list] ocaml, java, rmi and jini Martin Berger
2001-04-03 19:23                     ` Chris Hecker
2001-04-03 20:50                       ` Gerd Stolpmann
2001-04-06  9:40                         ` Sven LUTHER
2001-04-06 20:57                           ` Gerd Stolpmann
2001-04-03 21:06                       ` martinb
2001-04-06 15:03                     ` Xavier Leroy
2001-04-03 14:06                   ` [Caml-list] Future of labels, and ideas for library labelling Jacques Garrigue
2001-04-03 14:12                     ` Daniel de Rauglaudre
2001-04-03 14:42                       ` Claude Marche
2001-04-04 19:18                     ` Gerd Stolpmann [this message]
2001-04-03  9:55               ` Ohad Rodeh
2001-04-03 18:06                 ` [Caml-list] Example of Ocaml-syntax problem with ; Mattias Waldau
2001-04-04 15:15                 ` [Caml-list] Suspending threads Ohad Rodeh
2001-04-04 17:28                   ` Vitaly Lugovsky
2001-04-06 13:21                   ` Xavier Leroy
2001-04-03 12:02               ` [Caml-list] Future of labels, and ideas for library labelling Dave Mason
2001-04-03 13:43               ` Francois-Rene Rideau
2001-04-03 14:23                 ` Daniel de Rauglaudre
2001-04-03 13:43               ` Frank Atanassow
2001-04-03 13:58               ` Joshua D. Guttman
2001-04-03 16:52               ` Eric C. Cooper
2001-04-09  9:05                 ` John Max Skaller
2001-04-09  7:29             ` John Max Skaller
2001-04-03  8:07         ` Judicael Courant
2001-04-03  6:55     ` Chris Hecker
2001-04-03 18:13       ` [Caml-list] Generics? Brian Rogoff
2001-04-03 20:12         ` Chris Hecker
2001-04-10 16:48           ` John Max Skaller
2001-04-09  8:11       ` [Caml-list] Future of labels, and ideas for library labelling John Max Skaller
2001-04-09  9:21         ` Jacques Garrigue
2001-04-09 15:06           ` Fergus Henderson
2001-04-10 18:49           ` John Max Skaller
2001-04-09 19:54         ` Chris Hecker
2001-04-10  3:37           ` Jacques Garrigue
2001-04-10  7:42             ` Judicael Courant
2001-04-10  8:25               ` Jacques Garrigue
2001-04-10  8:46               ` Claude Marche
2001-04-10 10:09                 ` Jacques Garrigue
2001-04-10 14:42                   ` Lionnel Maugis
2001-04-10  9:06             ` François-René Rideau
2001-04-11 15:34               ` Jacques Garrigue
2001-04-11 17:48                 ` Dave Mason
2001-04-12 12:39                 ` [Caml-list] How do I define prog1? Mattias Waldau
2001-04-12 14:22                   ` Vitaly Lugovsky
2001-04-12 17:53                     ` William Chesters
2001-04-12 15:15                   ` Sven LUTHER
2001-04-12 16:14                     ` Mattias Waldau
2001-04-12 15:21                   ` Maxence Guesdon
2001-04-12 15:47                   ` Stefan Monnier
2001-04-17 20:04                     ` Chris Hecker
2001-04-10 22:43             ` [Caml-list] Future of labels, and ideas for library labelling Brian Rogoff
2001-04-11  8:29               ` Jacques Garrigue
2001-04-11  9:44                 ` Anton Moscal
2001-04-11 13:16                 ` Didier Remy
2001-04-11 15:11                   ` Jacques Garrigue
2001-04-03  7:27 Arturo Borquez
2001-04-03 16:39 John R Harrison
2001-04-04 16:37 Dave Berry
2001-04-11 10:48 Francois-Rene Rideau
2001-04-17 11:53 Poigné

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=01040422370105.00489@ice \
    --to=gerd@gerd-stolpmann.de \
    --cc=Jean-Christophe.Filliatre@lri.fr \
    --cc=caml-list@inria.fr \
    --cc=garrigue@kurims.kyoto-u.ac.jp \
    --cc=orodeh@cs.huji.ac.il \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).