Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: ketty <kattlachan@g...>
Subject: Re: [Caml-list] Ocaml compiler features
On 1/16/07, Edgar Friendly <thelema314@gmail.com> wrote:
> No, I want to make the following code legal:
>
> if y = 1 then
>         print_int y;
>         print_int z;
> else
>         print_string "not one"
>

correct me if i am wrong,

you want this to work like it currently does:
if cond then bla;
bla_outside_if;

and this to work like you describe it:
if cond then bla;
bla_inside_if;
else
inside_else;
what_about_this; (* ? *)

appart from the what_about_this expression, consider this:
if cond then
bla;
bla; if cond2 then bla;
bla;
bla;
else ... (* which if do this belong to? *)

allthough it is straitforward to say that else always belongs to the
"if" it is closest to, it does add a whole new elemnt of confusion.