[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: functional languages ill-suited for large programs?
From: "Tom Lord" <lord@emf.net>
>
> Has anyone ever tried to make a purely functional, lazy language
> implementation in which _every_ function is implicitly cached? The
> compiler optimization shifts in that case from "when should F be
> cached" to "when is clearly not worth bothering caching F" which is an
> easier (but still open-ended) problem.
My language codenamed "Lazy" (which is not purely functional, as it is
object-oriented as well, but it integrates a functional sublanguage)
automatically caches function executions (including the return value) based
on available memory, invocation frequency, calculation cost and cache
storage cost.
This means that the more memory is available, the more expensive the
function result is to calculate, the more frequently it gets invoked, and
the cheaper it is to cache, the higher the likelyhood a function result will
be cached.
"Lazy" invalidates caches based on a (lazy) truth-maintenance system, which
is required because functions on objects are replaceable by default (it is
the mechanism by which objects maintain 'state'). But objects can be
immutable (by nature or by being marked as such), and functions don't have
to be on objects, which is part of how the truth maintenance can be made
cheap.
A central tenet of "Lazy" is avoiding work, principally by not doing it as
long as its result is not required, and by avoiding doing the same work more
than once.
I'll be at LL3 this weekend, so If you are there and you are interested, I
would be happy to discuss this topic there.
Note: "Lazy" is a work in progress and I am currently working on an
execution caching universal VM. The VM is "universal" in the sense that it
is not just for "Lazy" semantics (in fact it has pluggable instruction
semantics and we are implementing standard Smalltalk semantics first). So
some time will surely pass before a practical implementation of "Lazy" will
see the light of day.
BTW, this work is fascinating and I would like to spend more time on it, but
it is heavily underfunded. So I would like to encourage anyone with an
interest, and a budget, to get in touch with me, at LL3 or otherwise.
Cheers,
Peter van Rooijen
Independent Researcher
Amsterdam