Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Evaluation Order
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-06-10 (11:23)
From: Tore Lund <tl001@o...>
Subject: Re: [Caml-list] Evaluation Order
Charles Martin wrote:
> The specification that indicates temporal preference is
>         let <first> in let <second> in ...

Does not a sequence accomplish the same thing?  According to the
"Développement" (book-ora028.html):

  La première de des structures typiquement impérative est la séquence. 
  Elle permet l'évaluation ordonnée de gauche à droite d'une suite 
  d'expressions séparées par un point-virgule. 


  Une séquence est une expression dont la valeur est celle de sa 
  dernière expression (ici, exprn). Néanmoins toutes les expressions 
  sont évaluées, et en particulier leurs effets de bord sont pris en 

If I read this right, it says that a sequence is evaluated from left to
right and side-effects are taking into account.  And it seems to work in
this example:

  # let _ =
      print_string "before";
      print_string "MIDDLE";
      print_string "after";;
  beforeMIDDLEafter- : unit = ()

but not in this one:

  # let _ =
      print_string "before";
      Format.print_string "MIDDLE";
      print_string "after";;
  beforeafterMIDDLE- : unit = ()

What's going on here?  All I did was to add "Format".  Is not printing
an "effet du bord"?

Bug reports:  FAQ:
To unsubscribe, mail  Archives: