[GiNaC-devel] printing of class power

Richard B. Kreckel kreckel at in.terlu.de
Tue Jan 7 23:20:04 CET 2025


Hi,

This is now about more than class 'power'...

On 1/7/25 12:12 AM, Stefan Weinzierl wrote:
> replacing print_func<print_dflt>(&power::do_print_dflt)
> by print_func<print_context>(&power::do_print)
> makes sense to me, it will treat the class power in the same way as the 
> classes add and mul.

Even if we fix it this way, the question remains: What purpose does the 
base class 'print_context' serve other than being an alias for 
'print_dflt' - at least for classes 'add', 'mul', 'power', 'numeric', 
'symbol', 'pseries', 'lst', 'matrix'? (There's still the same problem 
for 'clifford', 'spinmetric' and friends that could be fixed as well.)

I propose this:
1) Let's modify it such that 'print_context' provides the output of 
'print_dflt' for all classes derived from 'basic'.
2) Let's add a 'print_deterministic' subclass which lexicographically 
sorts the elements of classes where output order normally depends on 
addresses. Document it with a clear warning that the traversal-order 
might differ from the output order for this print context type.

Comments? (Notably about the first point, in case there is insight about 
the reasons of having two types 'print_context' and 'print_dflt'.)

All my best,
   -richy.
-- 
Richard B. Kreckel
<https://in.terlu.de/~kreckel/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://www.ginac.de/pipermail/ginac-devel/attachments/20250107/154fdc20/attachment.sig>


More information about the GiNaC-devel mailing list