From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA20654; Wed, 10 Dec 2003 11:28:02 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA20590 for ; Wed, 10 Dec 2003 11:28:01 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hBAAS0106557; Wed, 10 Dec 2003 11:28:00 +0100 (MET) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA20728; Wed, 10 Dec 2003 11:27:59 +0100 (MET) From: Pierre Weis Message-Id: <200312101027.LAA20728@pauillac.inria.fr> Subject: Re: [Caml-list] Question In-Reply-To: <3FCB610E.932B363B@tni.fr> from sebastien FURIC at "Dec 1, 103 04:41:02 pm" To: sebastien.furic@tni-valiosys.com (sebastien FURIC) Date: Wed, 10 Dec 2003 11:27:59 +0100 (MET) Cc: caml-list@inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; pierre:01 weis:01 pierre:01 weis:01 caml-list:01 ocaml's:01 invariants:01 runtime:01 compiler:01 cristal:01 semantics:01 wrt:01 wrt:01 behaviour:01 complexity:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk [...] > I was expecting "when" to be right distributive over "|". I find > OCaml's behaviour not very intuitive in such a situation. [...] The when construct introduces a guard to a pattern matching clause. This means that a when construct is global to the entire pattern of the clause it appears in; it means in particular that no when construct can be nested into a pattern and the question of its distributivity wrt any other construct is pointless. > Is there a good reason for this? Yes: simplicity, complexity invariants preservation for runtime pattern analysis decisions even in the presence of when clauses, easier understanding of the compiler warnings, simplicity and well-definedness semantics (in particular the desired invariance wrt the order of evaluation). > Cheers, > > Sébastien. Best regards, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/ ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners