Restrict variable names
Moderators: Dorian (MJT support), JRL
Restrict variable names
Imagine my surprise when I learned that I'd accidentally redefined 0 to a string. I'd love for the interpreter to check that variables begin with non-numeric values like most languages do. Maybe underscore and letters?
- Marcus Tettmar
- Site Admin
- Posts: 7380
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Restrict variable names
Why not use VAREXPLICIT?
https://www.mjtnet.com/manual/index.htm ... lution.htm
This allows you to distinguish between 0 and %0%. This is more like regular programming languages. Your code would not have failed in this case.
We won't be forcing variables to start with non numerics or we are very likely to break backward compatibility. We could make an option like VAREXPLICIT which prevents it, but for backward compat reasons would not make it default. Therefore you may as well just use your own sensible naming conventions.
https://www.mjtnet.com/manual/index.htm ... lution.htm
This allows you to distinguish between 0 and %0%. This is more like regular programming languages. Your code would not have failed in this case.
We won't be forcing variables to start with non numerics or we are very likely to break backward compatibility. We could make an option like VAREXPLICIT which prevents it, but for backward compat reasons would not make it default. Therefore you may as well just use your own sensible naming conventions.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?