RE: [boost] Re: FC++ formal review

And why do we have so many template to instantiate? Exactly my point: because we couldn't change type definition we could only create new one. How many helper templates gets instantiated to remove const types from the type-list? Should be none. So you are right: it has everything to do with nature of metaprogram evaluation engine, which is FP based one.
You have any grounds for this statement?
I meant from compilation time standpoint. Gennadiy.

"Rozental, Gennadiy" <gennadiy.rozental@thomson.com> writes:
Because each "instruction" of the abstract machine must be expressed in terms of a template instantiation.
Exactly my point: because we couldn't change type definition we could only create new one.
That's not the problem. In theory, at least, the functional system could be faster, in a program whose imperative formulation might repeat the same computation multiple times, because the functional system can cache all function results. In fact, that's exactly what template instantiation does. This is a well-known type of optimization (dynamic programming/memoization) that typically must be applied manually in an imperative system. Since the FP system can apply it automatically, FP can be a faster way to solve the problem.
How many helper templates gets instantiated to remove const types from the type-list?
What are you talking about?
Should be none.
You expect computation for free? As long as a template instantiation is the fundamental unit of metaprogram computation, anything you want to do is going to instantiate a template.
So you are right: it has everything to do with nature of metaprogram evaluation engine, which is FP based one.
Yes, I am right. It has everything to do with the nature of the engine, and nothing to do with FP.
Yes. If you write an interpreter in an interpreted language (C++ templates), you'll usually get something much slower. See Vesa Karvonen's experiments, http://article.gmane.org/gmane.comp.lib.boost.devel/9202 for example. The fact that he's interpreting a "functional" language as opposed to an imperative one is irrelevant... but of course, you probably won't believe me. It seems to me that my assertion that the speed issue has nothing to do with FP-vs-imperative is refutable, where as yours is not, so it should be up to you to provide a counterexample. OTOH, I'm pretty sure it's already been proven that functional programs are isomorphic with imperative ones, so any compiler could do that transformation as an optimization step if it proved to be helpful... so I wouldn't spend a lot of time searching for counterexamples if I were you ;-)
I also doubt that. AFAICT, most of what Spirit does at compile-time involves nothing that looks like a loop or recursion. Maybe somewhere in the subrules implementation... -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
David Abrahams
-
Rozental, Gennadiy