Article View: comp.lang.functional
Article #683Re: Resource control (was: Re: Why curry?)
From: Thomas M. Breuel
Date: Tue, 13 Oct 1992 01:05
Date: Tue, 13 Oct 1992 01:05
49 lines
2815 bytes
2815 bytes
In article <1992Oct12.150018.14053@kth.se> kff@dentex.tds.kth.se (Karl-Filip Faxen) writes:
(1) A compiler has no knowledge about input data (except for their
type). If the programmer has this knowledge, it can be communicated
to the compiler using annotations, or can be studied with profiling.
This of course requires access to "typical input", a somewhat shakey
notion, but no less shakey than the programmers intuition. Also,
the compiler could generate code for run-time scheduling in some
cases.
Actually, I think ultimately, this should go much further: code should
be compiled and optimized _on the fly_. There shouldn't be a division
into "compilation, profiling, optimizing, execution". Some Smalltalk
systems already do this, both in the form of byte-code->native-code
compilation for heavily used routines and in the form of backpatching.
I have done a little work on optimizing runtime type checking in
CommonLisp by gathering statistics and compiling code on the fly, but
the applications clearly go much further.
|> It may be that annotations are a good idea, separating data dependencies
|> from resource management decisions.
|>
|> Well, yes. And taking advantage of eager evaluation for these kinds of
|> "annotations" seems to be quite natural. Why change this?
Here, I'm afraid I don't understand what you want to say. Could you please
rephrase it?
What I'm saying is that most people who know SML reasonably well
understand clearly how I want my computation to be carried out when I
write something like:
fun f(x) =
let
val z = g(x)
in
fn y => h(y,z)
end
fun f'(x) = fn y => h(y,g(x))
In the first case, I don't want "g(x)" to be recomputed, in the second
case I do want it recomputed. It seems that this is annotation enough.
Why invent a new notation? (In those cases where you don't care, you
can simply choose one or the other, and even a compiler for an eager
purely functional language can often legally transform one version
into the other.)
Thomas.
Technical Details
Message-ID:
<TMB.92Oct12210548@arolla.idiap.ch>Path:
arc1-ca.pugleaf.net!sparky!uunet!think.com!mintaka.lcs.mit.edu!ai-lab!life.ai.mit.edu!tmbReferences:
<annius.717696151@freyr> <TMB.92Oct7181835@arolla.idiap.ch> <TMB.92Oct10173521@arolla.idiap.ch> <1992Oct12.150018.14053@kth.se>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!mintaka.lcs.mit.edu!ai-lab!life.ai.mit.edu!tmb From: tmb@arolla.idiap.ch (Thomas M. Breuel) Newsgroups: comp.lang.functional Subject: Re: Resource control (was: Re: Why curry?) Message-ID: <TMB.92Oct12210548@arolla.idiap.ch> Date: 13 Oct 92 01:05:48 GMT References: <annius.717696151@freyr> <TMB.92Oct7181835@arolla.idiap.ch> <TMB.92Oct10173521@arolla.idiap.ch> <1992Oct12.150018.14053@kth.se> Sender: news@ai.mit.edu Reply-To: tmb@idiap.ch Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle Perceptive) Lines: 49 In-reply-to: kff@dentex.tds.kth.se's message of 12 Oct 92 15:00:18 GMT