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
Ocaml compiler features
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-01-16 (06:00)
From: Edgar Friendly <thelema314@g...>
Subject: Re: [Caml-list] Ocaml compiler features
ketty wrote:
> you want this to work like it currently does:
> if cond then bla;
> bla_outside_if;
I haven't said anything about this pattern.  Definitely if there's an
else, it should allow a group of semi-colon separated expressions in
between.  ...  At the moment, I think that this form of if should stay.

> and this to work like you describe it:
> if cond then bla;
> bla_inside_if;
> else
> inside_else;
> what_about_this; (* ? *)
This is the hard choice.  Some sort of "end if" disambiguator would
clean up this whole mess pretty easily, but would be a pain to include
every time, especially when if is used like ?:.

I don't know if this is reasonable, but what about having an
if/then[/else] as now (no semis inside), but also having an
if/then[/else]/end that allows semi-delimited expressions inside?  This
would be light-weight (and non-intrusive), but still allow imperative
programmers their nice compound expressions inside if control paths.