[GiNaC-list] set_TeX_name() ?

Dale Lukas Peterson hazelnusse at gmail.com
Mon Dec 10 21:02:21 CET 2012


>         Just as a suggestion: instead of an introduction of a separate
>   method  set_TeX_name(), may be simpler to modify set_name() to have an
>   optional second argument for the Tex name (similar to the symbol()
>   method).

Here are the three options I can see.  First, a default parameter as I
think you are suggesting:

void set_name(const std::string & n, const std::string & texname = "")
{ name = n; TeX_name = texname; }

Second, overloading set_name:

void set_name(const std::string & n) { name = n; }
void set_name(const std::string & n, const std::string & texname) {
name = n; TeX_name = texname; }

Third, the option I originally proposed:

void set_TeX_name(const std::string & n) { TeX_name = n; }

I prefer my original proposal since it seems the most orthogonal to
me.  But any of them is really fine with me so that there is a way to
change the TeX_name after you've created an instance of symbol.  If
there is interest in keeping fewer methods, then I guess one of the
first two options would be preferable.

Thanks,
Dale


More information about the GiNaC-list mailing list