Silence warning about reference to free variable#283
Conversation
| ;;; Private variables | ||
| ;;; ************************************************************************ | ||
|
|
||
| (defvar hargs:reading-symbol nil |
There was a problem hiding this comment.
Could not see that this dynamic variable is defined anywhere. Should it not be that?
There was a problem hiding this comment.
I think we really need to add tests of the behavior of each of these variables first to ensure that these defvars do not interfere with any initializations that may take place in other modules/systems, notably for non-Hyperbole variables. Then we can apply the changes and verify things are good via the tests rather than worry about any behavior change, as some of these definitely were meant to perform with dynamic scope in the past.
There was a problem hiding this comment.
Adding test cases is a good idea but might be overkill and I'm not sure it is that straight forward in all cases to actually test the dynamic variables. So could take some time.
The hargs:reading-symbol is a hyperbole variable that I suppose is used as a cache remembering the current symbol that is read so setting it to nil initially should not matter since it would be overwritten all the time. But since it is variable defined by Hyperbole IMHO it is clearer to give it an initial value than to not define it at all!?
For the other defvars they do not initialize them but define them as being in the dynamic scope, and silence the warnings. So should only make the code be more in line with the good old dynamic days. We have used this technique in the past to remove the warnings for the undefined variable that originate from other packages. Is there any way that these defvars could change behavior?
| ;;; Private variables | ||
| ;;; ************************************************************************ | ||
|
|
||
| (defvar hargs:reading-symbol nil |
There was a problem hiding this comment.
I think we really need to add tests of the behavior of each of these variables first to ensure that these defvars do not interfere with any initializations that may take place in other modules/systems, notably for non-Hyperbole variables. Then we can apply the changes and verify things are good via the tests rather than worry about any behavior change, as some of these definitely were meant to perform with dynamic scope in the past.
c1e0b11 to
8a486dd
Compare
8a486dd to
2689fd2
Compare
What
Silence warnings about referencing free variables.
Before
After
Note
Added some comments below about some specific changes.