[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Aldor-l] [Axiom-developer] Re: exports and constants

From: Jacques Carette
Subject: Re: [Aldor-l] [Axiom-developer] Re: exports and constants
Date: Tue, 25 Jul 2006 10:59:05 -0400
User-agent: Thunderbird (Windows/20060516)

If you want a better experience with metaprogramming, I definitely recommend MetaOCaml ( Unlike Template Haskell, it is fully typed; TH only types the result of the generation, not the generator itself [though SimonPJ assures me they are working on that too].

Gabriel Dos Reis wrote:
(On performance side, last month, a colleague of mine and I did some
experiments by writing a small Computer Algebra library in Haskell 98
and Generic Haskell.  Disappointingly, there is a slowdown factor
between 7 and 10 when going from Haskell to Generic Haskell.  We don't
know yet which part can be credited to the maturity of the compiler
and which part is inherent to the approach.  Anyway, it was an
interesting experience).
Is this experiment available? I would be quite interested in looking at the details.

Getting efficiency from meta-programs seems to be quite difficult, and even more so in a typeful system. Enough has been said about C++ template programming to assure everyone that a) it is hard, and b) it's not *really* typed. But it *is* possible to get both genericity and efficiency. As a side effect, one can also get much better code organization as well! See the paper "Multi-stage programming with functors and monads: eliminating abstraction overhead from generic code" by Carette & Kiselyov
(paper, code, tests, etc at
published at GPCE05 (
as well as
which contains all the extras for an earlier paper published (later!) in
Science of Computer Programming (

You will see, especially in the GPCE05 work, code organization which is explicitly influenced by Axiom/Aldor. The principal reason that this work was done in MetaOCaml was that a) the type system is completely described (and proven to 'work') in published papers and b) the compiler sources are open [which was needed, not just nice-to-have].

Our basic thesis is that, given the right infrastructure, you can structure code like it ought to be structured (which is already what Axiom/Aldor strives for) and, without relying on the cleverness of compiler writers, get optimal efficiency. For linear algebra, this works. In separate work, it was shown that this works for FFT as well. We are currently extending the work to handle (numeric) solving of LODEs.


PS: MetaOCaml has no introspection features at _all_, by design. No 'has' of anything like it. That makes things extra-challenging, yet still feasible, which was not clear at all when the work was begun.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]