Re: optimization and purity

From: Pierre Weis (
Date: Fri Jul 23 1999 - 23:37:23 MET DST

From: Pierre Weis <>
Message-Id: <>
Subject: Re: optimization and purity
To: (Andrew Kennedy)
Date: Fri, 23 Jul 1999 23:37:23 +0200 (MET DST)
In-Reply-To: <7CD674FF54FBD21181D800805F57CD5488B073@RED-MSG-44> from "Andrew Kennedy" at Jul 23, 99 08:48:26 am

> 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

This mailing list archives contain an article about the history of the
problem, 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,,

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:23 MET