Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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. 

and:

  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 
  compte. 

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"?
-- 
    Tore

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr