Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* Re: Revised syntax question
@ 2000-09-26 14:58 Gerard Huet
  2000-09-26 17:15 ` Brian Rogoff
  2000-09-27  5:50 ` Daniel de Rauglaudre
  0 siblings, 2 replies; 7+ messages in thread
From: Gerard Huet @ 2000-09-26 14:58 UTC (permalink / raw)
  To: Brian Rogoff, caml-list

At 09:34 25/09/00 -0700, Brian Rogoff wrote:
>Hi,
>    I have an issue with the Revised syntax (from OCaml P4, with URL 
>http://caml.inria.fr/camlp4/manual/camlp4023.html). 
>
>How about 
>
>    do e1; e2; e3; done e4
>
>and change while/for to be consistent with this and return a value 
>in done?  
>
>    while e1 
>      do e2; 
>    done e3
>
>    for i = 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 
>using Revised have a different opinion?
>
>-- Brian

I hate this return, and actually I do not like this dangling e4. Every 
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 
    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érard





^ permalink raw reply	[flat|nested] 7+ messages in thread
* Revised syntax question
@ 2000-09-25 16:34 Brian Rogoff
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Rogoff @ 2000-09-25 16:34 UTC (permalink / raw)
  To: caml-list

Hi,
    I have an issue with the Revised syntax (from OCaml P4, with URL 
http://caml.inria.fr/camlp4/manual/camlp4023.html). 

How about 

    do e1; e2; e3; done e4

and change while/for to be consistent with this and return a value 
in done?  

    while e1 
      do e2; 
    done e3

    for i = 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 
using Revised have a different opinion?

-- Brian

    



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2000-09-28 14:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-26 14:58 Revised syntax question Gerard Huet
2000-09-26 17:15 ` Brian Rogoff
2000-09-27  5:50 ` Daniel de Rauglaudre
2000-09-27  9:29   ` Marcin 'Qrczak' Kowalczyk
2000-09-28  4:36   ` Brian Rogoff
2000-09-28 12:01     ` Daniel de Rauglaudre
  -- strict thread matches above, loose matches on Subject: below --
2000-09-25 16:34 Brian Rogoff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox