Variable Persistence in Modules
dchristo
Posts: 177
I've just discovered that Persistent variables do not work in Modules. Is this a bug or a "feature", and if the later, why?
Thanks,
--D
Thanks,
--D
0
Comments
I don?t know why but whoever does know can perhaps explain why you can?t pass a parameter to a module without creating a variable for it first. If you look up MODULE in the help file it states - Constants and expressions cannot be used as arguments in the parameter list. Why not? I never understood that one.
You cannot use persistent in modules because of the memory organization. I think modules are loaded after main code is, and persistent is performed at the very beginning.
You cannot use constant in modules because there is no mechanism in the module system to forward INSIDE the module the information that the parameter is a constant. You can modify the variable from both sides (inside and outside). So if you use a constant from the outside, it could be modified inside the module (in principle).
Fred