From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA20032 for caml-redistribution; Fri, 23 Jul 1999 23:43:37 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA19932 for ; Fri, 23 Jul 1999 23:37:26 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id XAA09025; Fri, 23 Jul 1999 23:37:24 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA19962; Fri, 23 Jul 1999 23:37:23 +0200 (MET DST) From: Pierre Weis Message-Id: <199907232137.XAA19962@pauillac.inria.fr> Subject: Re: optimization and purity To: akenn@microsoft.com (Andrew Kennedy) Date: Fri, 23 Jul 1999 23:37:23 +0200 (MET DST) Cc: caml-list@inria.fr In-Reply-To: <7CD674FF54FBD21181D800805F57CD5488B073@RED-MSG-44> from "Andrew Kennedy" at Jul 23, 99 08:48:26 am X-Mailer: ELM [version 2.4 PL24 ME8] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: weis > You are indeed correct that knowing the purity of functions would permit a > number of optimisations such as the loop-hoisting example you present. There > was quite a bit of work on "effect inference" a few years back, though much > of it had a different motivation, namely to permit more expressions to be > given polymorphic types in the let construct (e.g. in the current revision > of Standard ML -- sorry I don't know the situation for CAML -- the > expression let val x = rev [] in (1::x, true::x) end is ill-typed even > though it would be sound to assign it the obvious type). The Caml FAQ explains the problem, its solution in Caml, and why it is considered a good solution. See http://pauillac.inria.fr/caml/FAQ/FAQ_EXPERT-eng.html This mailing list archives contain an article about the history of the problem, http://pauillac.inria.fr/caml/caml-list/0485.html. It states that the Caml implementors impulsed a new interest on the subject by writing papers as soon as 1990. This article also recalls that the Caml compiler incorporates the restriction of polymorphism to non expansive expressions since 1995 (Caml-Light 0.7), even before Andrew Wright's article was published. Best regards, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/