caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
To: Christophe.Raffalli@univ-savoie.fr
Cc: caml-list@inria.fr
Subject: Re: Semantic of label: The best (only ?) solution to merge both mode
Date: Tue, 04 Apr 2000 14:50:25 +0900	[thread overview]
Message-ID: <20000404145025N.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: Your message of "Sun, 02 Apr 2000 21:24:59 +0200" <38E79E8B.100C8F60@univ-savoie.fr>

From: Christophe Raffalli <Christophe.Raffalli@univ-savoie.fr>

> Let's only talk about the modern mode !
> 
> I wanted to really use commuting labels, I was ready to change my habit,
> but I found them to restrictive. I find my proposal, which is just to
> change a bit the semantics of function application (and nothing else) on
> non-labelled arguments quite nice and useful (no need to always remember
> all the label names if you prefer to remember the order of the
> arguments). 

* They are (a bit) restrictive. This is intentional.
  (Still, there will be less labels in the standard library in 3.00.)
  Experience with olabl shows that non-optional labels are more useful
  as documentation than for commutation. If you don't have to write
  them, you will probably not write them, and you loose the benefit.
  Sometimes you have to be forced to do things that are good for you :-)
  And please do not compare this with ADA: these are only a few more
  characters, in an already very compact language.

* For you this is just a matter of remembering either position or
  labels.  But if someone is to read your code, he will have to switch
  from one to the other at each application, according to the one you
  choosed. Not so nice.


> As my proposal only cost to change about 20 lines why not have an option
> to the modern mode to let people try it for real and see what they think
> ?

This is not a problem of number of lines.
Before putting even one line of code in the type checker, we have to
be sure it is not breaking anything in the language.
I asked you to produce
1) type inference rules (which must mix with the rest of the language)
2) an untyped reduction semantics, including optional arguments
   (you cannot use the type of the function to decide how it should
    be evaluated, only its value)
These are pre-conditions.
If you do not produce these, this is just an idea, not a proposal.
And I don't see why I should do the work for you, since I am satisfied
with the current system.


> About the "so wonderfully clean theoretically" .. it is not so clear:
> look at this example:
> 
> > lama-d134:~> ocaml -modern
> >         Objective Caml version 2.99 (99/12/08)
> >  
> > # let h f = f x:1 y:2;;
> > val h : (x:int -> y:int -> 'a) -> 'a = <fun>
> > # let h f = f y:1 x:2;;
> > val h : (y:int -> x:int -> 'a) -> 'a =
> > <fun>                                                    
> > 
> > The infered type depends on the way you write thing while one could think 
> > they are equivalent (the labels commute in modern mode, don't they ?)

This is just an example of how keeping the theory clean may force you
to weaken the implementation.
In olabl those two types were to a great extent equivalent, but this
resulted in breaking the call-by-value semantics in some special
cases. We add to back on this.
If you really want those two types to be equivalent, you will have to
pay (probably a lot) in terms of efficiency. Considering that
commutation is not very useful in this particular case, it is better
to have the compiler refuse this code than turn it into an innefficient
blurb. Call it a trade-off. Not between theory and practice, just
between power and efficiency.

Regards,

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



  reply	other threads:[~2000-04-06 13:21 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-14 16:53 Syntax for label Don Syme
2000-03-14 18:05 ` Pierre Weis
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-18 10:32           ` Syntax for label, NEW SOLUTION Christophe Raffalli
2000-03-19  2:29             ` Jacques Garrigue
2000-03-20 18:25               ` Christophe Raffalli
2000-03-22  8:37                 ` Claudio Sacerdoti Coen
2000-03-21 23:29               ` John Max Skaller
2000-03-29  8:42               ` Semantic of label: The best (only ?) solution to merge both mode Christophe Raffalli
2000-03-29  9:53                 ` Christophe Raffalli
2000-03-30  9:49                   ` John Max Skaller
2000-03-30  9:39                 ` John Max Skaller
2000-03-31  4:34                   ` Jacques Garrigue
2000-04-01  1:53                     ` John Max Skaller
2000-04-02 19:24                     ` Christophe Raffalli
2000-04-04  5:50                       ` Jacques Garrigue [this message]
2000-04-03  7:57                     ` backward compatibility Christophe Raffalli
2000-03-15 21:30     ` Syntax for label, NEW PROPOSAL 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-24  9:54           ` labels & ocaml 3 & co David Mentré
2000-03-24 12:19             ` David Mentré
2000-03-21 22:22       ` Unsigned integers? John Max Skaller
2000-03-22 16:22         ` Sven LUTHER
2000-03-23  2:08           ` Max Skaller
2000-03-23  7:50             ` Sven LUTHER
2000-03-24  2:50             ` Jacques Garrigue
2000-03-24 15:59               ` Xavier Leroy
2000-03-25  4:03               ` John Max Skaller
2000-03-24 14:50             ` Xavier Leroy
2000-03-22 17:05         ` Jean-Christophe Filliatre
2000-03-22 19:10           ` Markus Mottl
2000-03-23  2:41           ` Max Skaller
2000-03-22 19:47         ` Xavier Leroy
2000-03-23 12:55           ` John Max Skaller
2000-03-16  8:50     ` Syntax for label, NEW PROPOSAL Pascal Brisset
2000-03-17 11:15       ` Sven LUTHER
2000-03-18  0:04     ` Syntax for label, ANOTHER " Steven Thomson
2000-03-15 20:39   ` Syntax for label (and more) Xavier Leroy
2000-03-17 10:03     ` Christian RINDERKNECHT
2000-03-17 17:19       ` Christophe Raffalli
2000-03-21  1:29     ` Markus Mottl

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=20000404145025N.garrigue@kurims.kyoto-u.ac.jp \
    --to=garrigue@kurims.kyoto-u.ac.jp \
    --cc=Christophe.Raffalli@univ-savoie.fr \
    --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).