Should I use g
-type when a constant variable may *occasionally* be altered
#1506
-
Recall that
I am now faced with a corner case, when a predefined variable in the document works for most of the time, but may be altered by the class user to fit their needs (e.g. something like |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
First, if a variable will be altered after initialization, it should not be named like a constant ( Then personally, I think a variable needs to be declared (and modified) global only if modification to it in any level of groups should always be global. Otherwise a local variable should suffice. |
Beta Was this translation helpful? Give feedback.
-
The idea of "c" is for constants that are really constants, i.e., where changes would result in incorrect code execution and not for something that is usually unchanged but can be changed. What can be changed and may be changed even if that happens only seldom is a variable in our model and there you have the distinction between global variables and local ones. Tracking anything else is something we think is not going to be helpful and it would be a difficult judgement call to identify what "seldom" means: it might mean never in most documents but often in a few documents or it might be changed in many but only in the preamble (usually) but ... Basically it would not be a consistent system. So, yes, you should use g or l for variables even if they are usually constant throughout a document. |
Beta Was this translation helpful? Give feedback.
The idea of "c" is for constants that are really constants, i.e., where changes would result in incorrect code execution and not for something that is usually unchanged but can be changed. What can be changed and may be changed even if that happens only seldom is a variable in our model and there you have the distinction between global variables and local ones. Tracking anything else is something we think is not going to be helpful and it would be a difficult judgement call to identify what "seldom" means: it might mean never in most documents but often in a few documents or it might be changed in many but only in the preamble (usually) but ... Basically it would not be a consistent system.