Version française
Home     About     Download     Resources     Contact us    
Browse thread
Functors ...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Thorsten Ohl <ohl@h...>
Subject: Re: Functors ...
Xavier Leroy <Xavier.Leroy@inria.fr> 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
slow?

Cheers,
-Thorsten
-- 
Thorsten Ohl, Physics Department, TU Darmstadt -- ohl@hep.tu-darmstadt.de
http://crunch.ikp.physik.tu-darmstadt.de/~ohl/ [<=== PGP public key here]