Dear Ondrej, On Fri, 4 Aug 2006, Ondrej Certik wrote:
You need to use a garbage collector, if you don't want to delete instances by yourself.
Yes, doing garbage collection is a reason to have a type ex. It is indeed possible to use another garbage collector. I'm not sure what it would do to performance. This might even depend on the particular computer algebra problem under considerating. Reference counting certainly is more predictable. Algorithms that would seem to be, say, O(N^6), will perform precisely like that in GiNaC. Another reason to have the type ex is automatic evaluation. If objects are to be made by constructors and after that we are going to pass around pointers to them, I'm not sure who is going to take care of automatic evaluation. You can get around this by declaring for every class a function that returns a basic* (as the "pow" function that you showed). However, that defeats the purpose of making the library simpler. Another nice thing about exes is that you can compare them by using the operator ==. That cannot be done with pointers, because it already means something else. Best wishes, Chris