newLISP Fan Club

Forum => newLISP newS => Topic started by: Lutz on June 16, 2008, 07:01:57 AM

Title: development release newLISP v9.3.16
Post by: Lutz on June 16, 2008, 07:01:57 AM
• 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
Title: Scope via global
Post by: DrDave on June 16, 2008, 07:16:54 AM
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.
Title:
Post by: HPW on June 16, 2008, 07:18:47 AM
Typo in Link!



http://www.newlisp.org/download/development