[Shootout-list] Ackermann

John Skaller skaller@users.sourceforge.net
Sat, 18 Jun 2005 18:02:30 +1000


On Fri, 2005-06-17 at 12:02 -0700, Brent Fulgham wrote:
> --- Einar Karttunen <ekarttun@cs.helsinki.fi> wrote:
> > Jon Harrop <jon@ffconsultancy.com> writes:
> > > I notice the fastest C++ implementation of
> > > Ackermann uses templates to do work at compile 
> > > time. Is this allowed? If so, am I allowed to 
> > > submit the equivalent OCaml?
> > 
> > That seems like cheating. In Haskell I can execute
> > all computations I want at compile time (without 
> > resorting to ugly templates). Do we really
> > want to start this path?
> 
> I agree.  

You agree to what?

> We need to move the C++ template version
> to "interesting alternative". 

This is no answer. You may be missing something 
fundamental. Brain dead systems like C++ require
compile time compilations to be distinctly coded.

Real partial evaluators don't *allow* you to
distinguish which phase code runs in.

ALL compilers are nothing but partial evaluators,
compilation and optimisation are precisely this.

However most compilers only have very brain dead
evaluation strategies (by research standards).

The simplest example is constant folding.

> > One vote for disallowing this - it should go as an
> > interesting alternative.

And one vote for throwing out 'do it the same way as 
my favourite brain dead language' and using 
functional specifications.

There is nothing wrong with the C++ template
solution -- let it stand. Because ... it is
going to be the SLOWEST solution around.

Of course, since we have partial evaluators,
we cannot just measure run time. We MUST measure
the whole time taken from source to result,
as if the program were interpreted: compile time
must be included.


-- 
John Skaller <skaller at users dot sf dot net>
Download Felix: http://felix.sf.net