From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA02500 for caml-red; Wed, 27 Sep 2000 09:29:19 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id HAA07721 for ; Wed, 27 Sep 2000 07:50:19 +0200 (MET DST) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.10.0/8.10.0) with ESMTP id e8R5oCL09246; Wed, 27 Sep 2000 07:50:12 +0200 (MET DST) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id HAA05840; Wed, 27 Sep 2000 07:50:12 +0200 Date: Wed, 27 Sep 2000 07:50:12 +0200 From: Daniel de Rauglaudre To: Gerard Huet Cc: Brian Rogoff , caml-list@inria.fr Subject: Re: Revised syntax question Message-ID: <20000927075012.C5396@verdot.inria.fr> References: <200009261500.e8QF0G520563@concorde.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0us In-Reply-To: <200009261500.e8QF0G520563@concorde.inria.fr>; from Gerard.Huet@inria.fr on Tue, Sep 26, 2000 at 04:58:33PM +0200 Sender: weis@pauillac.inria.fr Hi, On Tue, Sep 26, 2000 at 04:58:33PM +0200, Gerard Huet wrote: > I hate this return, and actually I do not like this dangling e4. I don't know what you have against the do...return construct, since we are in a functional language and this kind of construction separates the imperative part (do...return) which could (should) be typed "unit" and the functional part (after the return). My opinion is that in "e1;e2;..;en" the expression "en" has something different. I don't agree with the idea that some control is passed from e1 to e2, then e2 to e3. In sequence, we do "e1", then we forget it, we do e2, we forget it, and nothing at all runs from e1 to e2. And if your sequence is only composed of side effects, "en" included, you can write (it's what I do): do e1;e2;..;en; return () which appears to me very logical. Just consider "return ()" as the ending keyword. --- But... but! I don't want to make a business with that. We can talk about it, but I agree to change that into a completely symmetrical form like the one you propose if we are numerous enough to accept that form. Besides, there is the problem of the "let" inside sequences which my form does not allow. (Explanation: when you write in OCaml syntax: e1; e2; let x1 = f1 in e3; e4 actually, this sequence has 3 (not 4) expressions: e1; e2; (let x1 = f1 in e3; e4) since the binding x1 = f1 runs up to e4; in my syntax you have to write: do e1; e2; return let x1 = f1 in do e3; return e4 and I recognize it is ugly.) --- What about Michel Mauny's proposition for the sequence: do { e1; e2; ... ; en } The braces remind C language, what is logical, since it is imperative. The "let" up to the end of the sequence could be represented by "let binding ;", i.e. ended by just a semicolon instead of "in": do { e1; e2; let x1 = f1; e3; e4 } what would remind the "x1 = f1;" of C. The while and for constructs could be changed into: while e do { e1; ....; en } for x = e1 to e2 do { e1; ...; en } with the same ability to write this "let x = y;" I can implement that if there are several persons who like it, because, for the moment, I am used to "do...return ()" in my code, I wrote a lot of code with it and I don't want to change it if three days after, people tells me it is uglier. I can also change my syntax tree to that form and accept <:expr< do { e1; ... ; en } >> as sequence syntax tree. I consider simple parentheses as not enough "sequence". When a parenthesis is opened, if the expression is long, there is no way to know whether it is a sequence or not. There is the same problem with t-uples but generally, t-uples are shorter than sequences. I consider that the language should clearly show sequences, even with a loss of simplicity. -- Daniel de RAUGLAUDRE daniel.de_rauglaudre@inria.fr http://cristal.inria.fr/~ddr/