Kranc icon indicating copy to clipboard operation
Kranc copied to clipboard

Kranc should protect its predefined variables

Open eschnett opened this issue 13 years ago • 1 comments

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.

eschnett avatar Jun 14 '12 18:06 eschnett

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.

ianhinder avatar Jun 19 '12 06:06 ianhinder