caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: guttman@mitre.org (Joshua D. Guttman)
To: caml-list@inria.fr
Cc: guttman@mitre.org (Joshua D. Guttman)
Subject: Re: [Caml-list] Future of labels, and ideas for library labelling
Date: 03 Apr 2001 09:58:28 -0400	[thread overview]
Message-ID: <nhau246dr0b.fsf@malabar.mitre.org> (raw)
In-Reply-To: Xavier Leroy's message of "Tue, 3 Apr 2001 10:52:12 +0200"

I'm very grateful to Xavier Leroy for his posting.  I've been
listening to the labels discussion with increasing anxiety.  

I think we should make sure it remains possible to read and write Caml
code without added syntactic tangles; those tildes remind me of
whiskers.  More seriously, I find the syntax of Caml already fairly
obtrusive (versus Lisp and Scheme), and labels seem to me to make it a
good deal clumsier.  Why obstruct the fact that lots of code in a
language like OCaml is simply applying functions to arguments?  That's
the way it should be in a functional language.

Jacques Garrigue contrasts 

>   List.fold_right (List.fold_right IntSet.add) lists IntSet.empty

with 

>   
>      List.fold_left lists ~init:IntSet.empty
>        ~f:(fun set l ->
>              List.fold_left l ~init:set ~f:(fun set x -> IntSet.add x set))

and 

>      List.fold_left lists ~acc:IntSet.empty
>        ~f:(List.fold_left ~f:(fun ~acc item -> IntSet.add acc ~item))

To my eye, the original looks clean and compact.  The altered
versions?  They're not appealing to me.  

What are the arguments in favor of imposing labels on the rest of us?

1.  Optional arguments:  Well, this is occasionally useful, but I
    think not that often, at least in the kinds of programs I write.
    So the thing to achieve, in my opinion, is there should be no
    additional syntactic complication for writing or calling
    procedures that don't use them.

2.  Default values:  The Lisp-style solution to this was dynamic
    binding.  The default is stored in some mutable location; callers
    that want a different value store a new value and restore the
    original on return.  The language then provides some syntactic
    sugar (a macro) to make the alteration and restoration appear
    atomic, and to ensure that the default value is restored even in
    the case of non-local exit.  For instance, in the Yale dialect of
    Scheme, called T, there was a construct "bind".  I remember the
    manual saying, "Bind is syntactically similar to let but
    semantically very different."  The non-local exits were handled,
    within the "bind" macro definition, using unwind-protect, which
    was a primitive that would stipulate code to be run if the stack
    was unwound past the call site.

    I don't often need default values, but I expect that the
    equivalent could be rather easily implemented using exception
    handlers.  This would not affect any other aspect of the language.

3.  Documentation.  Why force every caller of a procedure to
    re-document the interface to the procedure?  That's what you're
    enforcing if the user has to write the labels.

    When it comes to documentation, there's no substitute for using
    the documentation itself.  Consider Emacs, the original
    self-documenting programming language (and it also contains a
    handy text editor :-).  Here the convention is that you document
    individual function definitions at a particular place; the
    "run-time system" then arranges for it to be very easy for users
    to access the documentation for every function (via C-h f).
    There's even completion if you type part of the name and want to
    see what function symbols start that way.  

    The etags program also provides a lot of support for people
    writing in other programming languages.  By the way, whatever
    happened to the OCaml mletags program?  I think it's been defunct
    since Ocaml 1.

    We could invent ways that people could get some of the benefit of
    the Emacs help system for Ocaml definitions documented in the
    manual.  I've been tinkering with an Emacs procedure that calls
    grep to find occurrences of a name in the manual, and W3 to
    display the corresponding HTML within Emacs.

    But the point here is to make documentation easily accessible, or
    to make it easy to find the site of definition for a procedure.
    It's wrong in my opinion to make the user repeat the documentation
    in the form of tilded labels at every use.  

4.  Commuting arguments.  This has to be a pretty specialized need,
    especially assuming programmers have easy access to documentation
    to find the intended order.  You're going to clutter a whole
    language to support this peripheral need?  


This language is complicated already.  It's extremely good, and I'm
doing my best to convert others to be followers of the cult too.  But
it's complicated, and we'll fight more losing battles to teach people
to use it if it becomes syntactically more cluttered.  Whether it's a
question of students (as in Benjamin Pierce's case) or colleagues (as
in mine), let's not block access to the really good (but subtle) ideas
in the language by complicating the way that it's written.

So my vote:  Please ensure that the programmer will not have to use
labels, except perhaps when using specialized libraries (e.g. for
GUIs).  

But to all participants, I'd like to say once more:  It's a splendid
language, the product of enormous intelligence and hard work, and I
appreciate being able to use it.

        Joshua 
-- 
	Joshua D. Guttman		<guttman@mitre.org> 
	MITRE, Mail Stop S119 
	202 Burlington Rd.		Tel:	+1 781 271 2654
	Bedford, MA 01730-1420 USA	Fax:	+1 781 271 3816

-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


  parent reply	other threads:[~2001-04-03 13:58 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
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 [this message]
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=nhau246dr0b.fsf@malabar.mitre.org \
    --to=guttman@mitre.org \
    --cc=caml-list@inria.fr \
    /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).