English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
new emacs tuareg mode release
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-05-27 (16:01)
From: Edgar Friendly <thelema314@g...>
Subject: Re: [Caml-list] New emacs tuareg mode
On 05/27/2010 02:46 AM, David Baelde wrote:
>   For example:
> if blah then
>    let () = f () in
>    g () ;
>    h ()
> is not the same as
> if blah then
>    f () ;
>    g () ;
>    h ()
This difference is only because of (what I perceive as) flaws in the 
[if]/[then] syntax.  Namely that semicolon-delimited chains of 
expressions don't parse within the [then] or [else] sections without 
extra bracketing. This lets adding a bit of debug code (in if/then - 
exactly where it's usually needed) to totally break the semantics by 
pushing code outside the if/then expression. With improper indentation 
(like your second example), one can make it look like one thing is 
happening while another will happen.

Your first code block is a good example of non indented [let] blocks 
looking good.  Your second example should be indented as follows to 
clarify its actual structure:

if blah then
   f () ;
g () ;
h ()