Erik de Castro Lopo a écrit : > Bárður Árantsson wrote: > >> What you're saying is basically that lazy pattern matching should only >> force as much of the value under examination as is actually necessary to >> decide if there's a match. Do I have that right? >> >> If so, then Haskell does exactly this. > > But haskell is lazy by default so of course it does it right. > You mean that if I write (I use OCaml syntax) match p, q with | (true, true) -> | _ -> Haskell will first check if (p is evaluated and false) or (q is evaluated and false) and then, if it is not the case will evaluate p, and finally if p is true it will evaluate q ? This would mean that compilation of pattern matching in Haskell is a real nightmare ... (this is already very painfull in OCaml) ... In fact, this also means that it is not trivial to explain to the programmer the semantics of deep pattern-matching chosen by a given lazy language ... In Ocaml the programmer really needs to say what he/she wants and can implement the above test by hand and it may be considered as a good thing ? > Erik Cheers, -- Christophe Raffalli Universite de Savoie Batiment Le Chablais, bureau 21 73376 Le Bourget-du-Lac Cedex tel: (33) 4 79 75 81 03 fax: (33) 4 79 75 87 42 mail: Christophe.Raffalli@univ-savoie.fr www: http://www.lama.univ-savoie.fr/~RAFFALLI --------------------------------------------- IMPORTANT: this mail is signed using PGP/MIME At least Enigmail/Mozilla, mutt or evolution can check this signature. The public key is stored on www.keyserver.net ---------------------------------------------