metacode rread-only variables
-
My suggestion is to be able to create "global" variables ( also would work for "var" ) that could be declared "read-only", meaning that only the assignment in the declaration of the variable would be valid and using "set" would be flagged as invalid. As I clean up my firmware for my multi-tool printer I am finding that some global variables are really global constants (like the docking positions of the tools) vs true variables (like the previous upTime a macro was called).
The declaration syntax would up to the firmware team.
Thanks!
Gene
-
@GeneRisi Can you give me a usecase for this wish?
I'm not sure if this is necessary? If you never use a "set" command in your meta code, the global will stay as it is.... -
@cosmowave said in metacode rread-only variables:
If you never use a "set" command in your meta code, the global will stay as it is....
I think that's the whole point of it, to prevent it from being changed.
One way of doing this would be to introduce new commands "const global" and "const var" that behave like "global" and "var" but the value is not allowed to be changed. Or maybe "global const" could create a global constant and "const" by itself create a local constant.
@GeneRisi feel free to create a Github feature request for this.