From: John Prevost <prevost@maya.com>
To: Don Syme <dsyme@microsoft.com>
Cc: "'Jacques Garrigue'" <garrigue@kurims.kyoto-u.ac.jp>,
"'caml-list@inria.fr'" <caml-list@inria.fr>
Subject: Re: Syntax for label, NEW PROPOSAL
Date: 17 Mar 2000 14:24:35 -0500 [thread overview]
Message-ID: <87bt4dqu18.fsf@isil.localdomain> (raw)
In-Reply-To: Don Syme's message of "Fri, 17 Mar 2000 09:03:56 -0800"
Don Syme <dsyme@microsoft.com> writes:
> o To ensure "living happily together", my feeling is you should
> leave the standard library alone (though I could live with 2 or 3
> functions having labels), but go wild with labels and variants in
> the places were no one doubts they will be useful.
I think I agree here. I do see labels as useful in a number of places
(certainly places like Tk where you have large numbers of arguments,
many of which are optional.) But, in places in the standard library,
you can create some big nasty messes. The List.fold_right example is
a good one. On the one hand, I do have to think about which way the
folding is going to happen, and which argument to the f argument is
which. On the other, there are very few places where a function which
is useful for folding has an acc argument.
Arguing that a consistent labelling style is good is a nice point. If
every function that uses an argument in a certain way has the same
label, it makes it easier to remember what's going on. But the
functions which need labels most (those which have many arguments)
have the most specialized labels. And the functions which are most
standard have little ambiguity, leaving reordering of arguments the
only benefit:
let foo l = map l
fun:function
...
...
...
I like the ability to move the "heaviest" clause of my expression to
the end, but I'm not willing to put up with the acc thing in
fold_right to get it. And of course, reordering is only available in
"modern" mode.
If we could come up with a semantics where labels are always optional,
I think I would accept things like acc in the standard library. But
when you have to make a choice between optional labels and no useful
functionality, it's a harder sell.
I can imagine a system in which an unlabelled argument means "the next
argument in the argument list, regardless of label" and a labelled
argument means "the next argument in the argument list with this
label". Of course, this leads to oddness. Let's look at map for a
simple example:
map : f:('a -> 'b) -> 'a list -> 'b list
(I assume this hasn't changed. I'm using f instead of fun.)
map x : 'a list -> 'b list
map f:x : 'a list -> 'b list
without a label for the 'a list, there's no way in this optional-label
scheme to re-order the argument earlier. So this would seem to imply
that labels would only be useful if there were many different labels,
or if unlabelled arguments were "first":
map2 : 'a list -> f:('a -> 'b) -> 'b list
this option is irritating because it changes the default ordering.
And the standard ordering makes a lot more sense, even when you can
write:
map2 fun:f
to get the old behavior.
map3 : f:('a -> 'b) -> list:('a list) -> 'b list
this option preserves the standard ordering, but we had to define a
label for the second argument. That's more okay than it would be in a
system where labels are mandatory, but it means more work for people
writing libraries using labels. The now need to think about a
"standard" ordering for the arguments, as well as a "labelling" which
allows reordering.
Summary:
The standard library should not have labels unless labels undergo a
massive change in semantics which will remove the known-ness of
labels' utility in O'Labl.
I want labels for working with things like LablTk and LablGtk. But
when it comes to the standard library, I agree with the SML people.
"Gross!" I use O'Caml because it has a nicer, cleaner syntax than
SML. Mucking it up like this, even as an optional mode, is bad.
John.
next prev parent reply other threads:[~2000-03-18 17:49 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-17 17:03 Don Syme
2000-03-17 19:24 ` John Prevost [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-03-17 21:33 Damien Doligez
2000-03-18 21:07 ` Frank Atanassow
2000-03-18 22:40 ` John Prevost
2000-03-15 20:40 Don Syme
2000-03-17 9:48 ` Jacques Garrigue
2000-03-17 17:34 ` Dave Mason
2000-03-18 0:26 ` Jacques Garrigue
2000-03-23 13:07 ` Sven LUTHER
2000-03-14 16:53 Syntax for label Don Syme
2000-03-15 3:15 ` Syntax for label, NEW PROPOSAL Jacques Garrigue
2000-03-15 6:58 ` Christophe Raffalli
2000-03-15 21:54 ` Julian Assange
2000-03-15 11:56 ` Wolfram Kahl
2000-03-15 13:58 ` Pierre Weis
2000-03-15 15:26 ` Sven LUTHER
2000-03-17 7:44 ` Pierre Weis
2000-03-15 17:04 ` John Prevost
2000-03-17 10:11 ` Jacques Garrigue
2000-03-15 17:06 ` Markus Mottl
2000-03-15 19:11 ` Remi VANICAT
2000-03-17 8:30 ` Pierre Weis
2000-03-17 14:05 ` Jacques Garrigue
2000-03-17 16:08 ` Pierre Weis
2000-03-15 21:30 ` John Max Skaller
2000-03-16 2:55 ` Jacques Garrigue
2000-03-17 15:13 ` Pierre Weis
2000-03-17 17:33 ` Wolfram Kahl
2000-03-18 11:59 ` Jacques Garrigue
2000-03-21 16:51 ` Pascal Brisset
2000-03-23 11:14 ` Nicolas barnier
2000-03-16 8:50 ` Pascal Brisset
2000-03-17 11:15 ` Sven LUTHER
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=87bt4dqu18.fsf@isil.localdomain \
--to=prevost@maya.com \
--cc=caml-list@inria.fr \
--cc=dsyme@microsoft.com \
--cc=garrigue@kurims.kyoto-u.ac.jp \
/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