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 WAA00465 for caml-red; Tue, 26 Sep 2000 22:10: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 RAA26962 for ; Tue, 26 Sep 2000 17:00:20 +0200 (MET DST) Received: from HUET-GERA1P (huet-gera2p.inria.fr [128.93.20.113]) by concorde.inria.fr (8.10.0/8.10.0) with SMTP id e8QF0G520563; Tue, 26 Sep 2000 17:00:16 +0200 (MET DST) Message-Id: <200009261500.e8QF0G520563@concorde.inria.fr> X-Sender: huet@pop-rocq.inria.fr X-Mailer: QUALCOMM Windows Eudora Pro Version 4.0.2 Date: Tue, 26 Sep 2000 16:58:33 +0200 To: Brian Rogoff , caml-list@inria.fr From: Gerard Huet Subject: Re: Revised syntax question Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: weis@pauillac.inria.fr At 09:34 25/09/00 -0700, Brian Rogoff wrote: >Hi, > I have an issue with the Revised syntax (from OCaml P4, with URL=20 >http://caml.inria.fr/camlp4/manual/camlp4023.html).=20 > >How about=20 > > do e1; e2; e3; done e4 > >and change while/for to be consistent with this and return a value=20 >in done? =20 > > while e1=20 > do e2;=20 > done e3 > > for i =3D e1 to e2 do e3; done () > >This saves a keyword "return" and looks a bit more consistent, though >maybe a touch noisier when you don't return a value from a loop. Anyone=20 >using Revised have a different opinion? > >-- Brian I hate this return, and actually I do not like this dangling e4. Every=20 imperative programming language I used had a list of statements construct, and from LISP onwards we know how to mix imperative statements and values (good old progn !). Semantic ayatollahs notwithstanding, it makes perfect sense to interpret the sequence (s1 ; s2 ; ... ; sn) with operator ";"= piping the state of its first argument into the second one, and returning the value of the second one. Furthermore it is consistent with the rest of the syntax to use good old parentheses as begin-end brackets. All you need is to EXTEND the revised syntax with a 5 line entry for expr at LEVEL "simple". I usually indent my code ( statement 1 ; statement 2 ... ; statement n ) nicely symmetrical to=20 match foo with (or fun or try expr with) [ case 1 | case 2 ... | case n ] and I read "begin" for "(", "then" for ";" and "end" for ")", although sometimes I say "returned" when I want to emphasise the returned value. I'll be glad to communicate the 5 lines of camlp4 to whoever wants to try this syntax; but all flame should be sent to /dev/null Cheers, G=E9rard