Re: Functors ...

From: Thorsten Ohl (
Date: Tue Jun 23 1998 - 19:00:26 MET DST

Date: Tue, 23 Jun 1998 19:00:26 +0200
Message-Id: <>
From: Thorsten Ohl <>
To: Xavier Leroy <>
Subject: Re: Functors ...
In-Reply-To: <>

Xavier Leroy <> writes:

> In principle, the module language is terminating, so the compiler
> could simply generate a copy of the functor body at each functor
> application point, and work from here. This would allow more
> direct calls and inline expansion -- as much as if you'd written
> your code without functors -- but results in loss of separate
> compilation (the functor body is recompiled over and over again)
> and code bloat. C++ templates have precisely those two problems.

What about a compiler option (or directive) for selective functor
expansion? This way one can use the profiler (or static information
about the program) to fight code bloat by expanding just the functor
applications in the compilation units that appear to produce the most
frequently executed code?

I agree that it is not a very elegant solution. But why not, as long
as it helps to fight the misconception that functional programming is


Thorsten Ohl, Physics Department, TU Darmstadt -- [<=== PGP public key here]

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