Closed phoe closed 1 year ago
Thanks for the heads-up, adding that now. I've been under the assumption that constants were evaluated at both compile and load time, but apparently that's up to the impl
The COMPILER in COMPILE-FILE does put the result of the evaluation in of defconstant its own environment, so when it encounters the same symbol, it can use the value instead (though doesn't have to). The problem in this specific case is that the constants are used later in the same file inside a #. form, so it is the READER that evaluates them, and the READER doesn't know about the COMPILER environment. That is not implementation dependent, and implementation that doesn't give an an error in this case is actually not compliant.
Is there still an issue after the addition of cl:eval-when
? Should I avoid the #.
form or something else?
No and maybe.
I just thought it would be useful to clarify that it is not impementation dependent. It was actually a bug that needed fixing.
You often get this kind of bugs when using #., which probably make it better to avoid use it. But once you fixed it, it will work, and in this specific case there is no obvious better solution.
Okay cool, thanks. Yeah I was just concerned there was something I missed
These two need an
EVAL-WHEN :COMPILE-TOPLEVEL
around them so that the definition is always available at compilation time:https://github.com/Zulu-Inuoe/jzon/blob/90c9eed6f4b4efaa290ce1d5fc763b8aa6e2a9db/src/eisel-lemire.lisp#L30-L31