Re: [GiNaC-list] set_TeX_name() ?
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
Does anybody else (i.e., developers or other users) have any comments regarding these methods for changing the TeX_name data member? This is a minor change and I think it would be nice to have the functionality. Thanks, Dale On Mon, Dec 10, 2012 at 12:02 PM, Dale Lukas Peterson <hazelnusse@gmail.com> wrote:
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
-- “People call me a perfectionist, but I'm not. I'm a rightist. I do something until it's right, and then I move on to the next thing.” ― James Cameron
I like the idea of adding a new method: void set_TeX_name(const std::string & n) because you can change the texname witdout doing something like: symbol toto('sigma'); toto.set_name(toto.get_name(), "\sigma"); Felipe Le 11/12/2012 11:21, Dale Lukas Peterson a écrit :
Does anybody else (i.e., developers or other users) have any comments regarding these methods for changing the TeX_name data member? This is a minor change and I think it would be nice to have the functionality.
Thanks, Dale
On Mon, Dec 10, 2012 at 12:02 PM, Dale Lukas Peterson <hazelnusse@gmail.com> wrote:
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
-- Felipe Bordeu Weldt Ingénieur de Recherche ------------------------------------- Tél. : 33 (0)2 40 37 16 57 Fax. : 33 (0)2 40 74 74 06 Felipe.Bordeu@ec-nantes.fr Institut GeM - UMR CNRS 6183 École Centrale Nantes 1 Rue de La Noë, 44321 Nantes, FRANCE -------------------------------------
I like the idea of adding a new method:
void set_TeX_name(const std::string & n)
because you can change the texname witdout doing something like:
symbol toto('sigma'); toto.set_name(toto.get_name(), "\sigma");
I agree. What about whether TeX_name should be mutable or not? I think it probably should be, since name is mutable. Do tests need to be implemented for this patch, or is there anything else I can do to facilitate this small bit of code becoming part of GiNaC? Thanks, Dale
Do tests need to be implemented for this patch, or is there anything else I can do to facilitate this small bit of code becoming part of GiNaC?
Thanks, Dale
Hi! I think this functionality would be useful and belongs in GiNaC. Do you agree? If so, please let me know if you would prefer a different implementation of this method, and whether TeX_name should also be mutable like the name member variable, and I would be happy to send an updated patch. If not, could you please explain why? Thanks, Dale
On 12/10/2012 09:02 PM, Dale Lukas Peterson wrote:
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.
Well, Option 1 breaks the binary interface. Option 2 doesn't. And option 3 clearly doesn't either. Just my 2c -richy. -- Richard B. Kreckel
On 12/16/2012 11:51 PM, Dale Lukas Peterson wrote:
Well, Option 1 breaks the binary interface. Option 2 doesn't. And option 3 clearly doesn't either.
Good point. What do you think about symbol::TeX_name being mutable?
Is there a reason to make it mutable? (Have a look at symbol::get_name() to see why symbol::name is mutable.) -richy. -- Richard B. Kreckel <http://www.ginac.de/~kreckel/>
Good point. What do you think about symbol::TeX_name being mutable?
Is there a reason to make it mutable? (Have a look at symbol::get_name() to see why symbol::name is mutable.)
I guess as long as there is no need to implement get_TeX_name() in the same fashion as get_name(), then it should not be mutable. Dale
What needs to happen in order for this patch to get pushed in? On Sun, Dec 16, 2012 at 11:27 PM, Dale Lukas Peterson <hazelnusse@gmail.com> wrote:
Good point. What do you think about symbol::TeX_name being mutable?
Is there a reason to make it mutable? (Have a look at symbol::get_name() to see why symbol::name is mutable.)
I guess as long as there is no need to implement get_TeX_name() in the same fashion as get_name(), then it should not be mutable.
Dale
-- “People call me a perfectionist, but I'm not. I'm a rightist. I do something until it's right, and then I move on to the next thing.” ― James Cameron
On 01/20/2013 10:10 PM, Dale Lukas Peterson wrote:
What needs to happen in order for this patch to get pushed in?
Well, generally, a complete and tested patch that applies to master. (And somebody who finds the time to push it. This seems to be difficult.) Anyway, it is in now. Thanks! -richy. -- Richard B. Kreckel
Thank you for pushing the change, I know time is a valuable commodity. Is a email to this list with an attached patch the preferred patch submission route? Alternatives include a public git repo with a branch that can be cloned, tested and merged into master. Alternatively git has pull requests, and so do sites like github, but not all projects use this approach. Thanks, Luke On Wed, Jan 23, 2013 at 12:26 AM, Richard B. Kreckel <kreckel@ginac.de> wrote:
On 01/20/2013 10:10 PM, Dale Lukas Peterson wrote:
What needs to happen in order for this patch to get pushed in?
Well, generally, a complete and tested patch that applies to master. (And somebody who finds the time to push it. This seems to be difficult.)
Anyway, it is in now. Thanks!
-richy. -- Richard B. Kreckel
_______________________________________________ GiNaC-list mailing list GiNaC-list@ginac.de https://www.cebix.net/mailman/listinfo/ginac-list
-- “People call me a perfectionist, but I'm not. I'm a rightist. I do something until it's right, and then I move on to the next thing.” ― James Cameron
participants (3)
-
Dale Lukas Peterson
-
Felipe Bordeu
-
Richard B. Kreckel