• bug fixes for 'randomize' and 'rand'
• a bug fix for 'gs:menu-item-check'
• more corrections in the 9.4.0 manual
for files and CHANGES notes see: http://www.newlisp.org/download/development
development release newLISP v9.3.16
development release newLISP v9.3.16
Last edited by Lutz on Mon Jun 16, 2008 2:44 pm, edited 1 time in total.
Scope via global
I was looking at the global function to create global variables. If I make a variable global, isn't it still possible to create a variable that uses the same variable name inside of a differnt context that is now distinct from the global variable?
If so, should that really be the behavior? Intuitively, I would expect that if a variable is made global that this name would now be unavailable to other contexts for use. To me, as a "casual" programmer, allowing the existence of the same variable name for global plus any other context partially defeats the idea behind the global variable. But maybe otherwise the idea of having a context would be defeated.
However, I can see that perhaps global is just a "convenience" to avoid having to prefix MAIN: to access the global variable when working in another context. And that if global were to behave as I think it should, then it would have to scan all the existing variable names in all contexts to see if that name is already in use.
Of course it is easy enough for me to prefix a "g" to all global variables names to avoid confusion.
If so, should that really be the behavior? Intuitively, I would expect that if a variable is made global that this name would now be unavailable to other contexts for use. To me, as a "casual" programmer, allowing the existence of the same variable name for global plus any other context partially defeats the idea behind the global variable. But maybe otherwise the idea of having a context would be defeated.
However, I can see that perhaps global is just a "convenience" to avoid having to prefix MAIN: to access the global variable when working in another context. And that if global were to behave as I think it should, then it would have to scan all the existing variable names in all contexts to see if that name is already in use.
Of course it is easy enough for me to prefix a "g" to all global variables names to avoid confusion.
Last edited by DrDave on Mon Jun 16, 2008 8:35 pm, edited 3 times in total.
...it is better to first strive for clarity and correctness and to make programs efficient only if really needed.
"Getting Started with Erlang" version 5.6.2
"Getting Started with Erlang" version 5.6.2