[GiNaC-list] Python wrapper for a GiNaC derived library

Alexander Frink Alexander.Frink at Uni-Mainz.DE
Mon Aug 7 17:51:35 CEST 2006

On Fri, 4 Aug 2006, Ondrej Certik wrote:
> you need to inherit basic from "gc". gc_cpp is from
> http://www.hpl.hp.com/personal/Hans_Boehm/gc/

The roots of GiNaC date back to 1998. I do not know if the gc library had
been available at that time (the oldest files in the gc archive date
1999), at least it was not very common and/or not known to me. So we had
to invent our own thing.

> So back to the original question: is ex only used to do the garbage
> collection? The syntax above is imho much less complex than the whole
> thing with ex, on the other hand, I understand that if you implement
> garbage collection yourself in ex, you have much bigger control of it,
> and also (maybe) it is faster.

As already written, assignments to references do not work in C++ as
someone familiar with Java, C# or other modern garbage collected languages
might expect.

Using pointers is too dangerous with respect to memory leaks.

Smart pointers (std::auto_ptr) solve the memory leak problem, but were
relatively new in C++ at this time and do not support reference counting,
which means worse performance.

Hence we decided to introduced the ex class, which is in principle a
smarter smart pointer and was fully under our control.

I think comparison using == and automatic evaluation have been positive
side effects of this decision.


Alexander Frink                      E-Mail: Alexander.Frink at Uni-Mainz.DE
Institut fuer Physik                 Phone:  +49-6131-3923391
D-55099 Mainz, Germany

More information about the GiNaC-list mailing list