Skip to Content.
Sympa Menu

mathemagix-devel - New version and discussion on C++ templates

Subject: Mathemagix

List archive

New version and discussion on C++ templates


Chronological Thread 
  • From: Joris van der Hoeven <address@concealed>
  • To: <address@concealed>
  • Subject: New version and discussion on C++ templates
  • Date: Wed, 3 Dec 2003 13:05:09 +0100 (CET)


Hi *,

I just made Mathemagix-0.1.32 available and I will
have to get back to doing mathematics for some time...

The new version features improved pretty printing,
several improvements in the grammar and C/C++
pretty printing. The TeXmacs interface should be
quite functional too from now on.

I also started working on the glue mechanism for C++ templates.
In principle, Bernard Mourrain is taking care of the generation
of the real glue code, but some additional code is need in
order to deal with templates and genericity. This is what
I should do.

The idea is as follows (see the files mmx/glue/test.mml and
mmx/glue/test.out.cc for an example): you specify the exported
routines and templates in the glue file, as well as the routines
which you wish to make generic (the imports). From this information,
the program mmx-extend will automatically produce (very efficient)
code for a dynamic generic type which could also be used independently
from Mathemagix (so as to boost your C++ template library with more
dynamic objects).

A generic object, as usual, is a pointer (the object) together
with its type. In fact, this is the way generic objects may be
dealt with in the glue code (Bernard). Internally, a more efficient
implementation is used: a finite number of generic instance types
are created, and for each generic instance type, we create a static
variable which containts the corresponding type. The contents of
these static variables may change a lot during computations,
but only a finite number (the maximal number of type arguments in
template type constructors) of them is needed.

To start, I will systematically work with pointers to the user types.
At a later stage, if the user types are already pointers, then further
optimizations might be needed. I also do not want to take care of
destructors at a first stage: we will use Boehme's gc.

A final note for Bernard: at a first stage, I do not plan to use
the current elaborate syntax for dealing with arguments in .mml files.
Indeed, this would further complicate writing the mmx-extend program,
which is already complicated enough. In fact, it is not clear at all
to me that we need the elaborate syntax: our language is powerful
enough to state function types and template types, so why not simply
use that. Notice that all your examples in mmx/glue could be dealt
with in a similar way as mmx/glue/test.mml.

Another final note for Bernard: I changed the /{...}/ to /"..."/.
Please check the Changelog, where I will mention important changes
for others than me.

Best wishes, Joris



  • New version and discussion on C++ templates, Joris van der Hoeven, 12/03/2003

Archive powered by MHonArc 2.6.18.

Top of Page