ianhinder / Kranc

A Mathematica package for generating code for solving time dependent partial differential equations
http://kranccode.org
GNU General Public License v2.0
28 stars 10 forks source link

Kranc should protect its predefined variables #70

Open eschnett opened 12 years ago

eschnett commented 12 years ago

Kranc defines several variables that can be used in calculations, such as e.g. dx, dy, dz. These should be protected, so that one cannot accidentally assign a new value to them, which leads to strange results.

ianhinder commented 12 years ago

Do you mean that Kranc should prevent shorthands and gridfunctions being defined by the user with these names? Yes, I agree. We should have a list of protected names which cannot be used. It would be good if this could be kept up-to-date automatically in the code, otherwise it will rot.

A similar idea would be to use a different namespace for Kranc's internal variables, so that no collision was possible and the user can use whatever variable names they like. This does not solve the problem of a user defining, for example, a variable called "strcpy" or some other existing symbol. I think the best solution would be for the user's variables to be in their own namespace, but this is probably not supported by Cactus.