Fix macro hygiene in @constant
, @derived_constant
(missing esc()
)
#36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The constant definition macros have some issues where not all inputs are escaped using
esc()
, so that existing variables cannot be referred to in some of the arguments. For example, this affects theval
argument of@constant
and@derived_constant
(but not the correspondingdef
). I suspect this is why derived constants have theirFloat64
values (but not theirBigFloat
values!) hard-coded using float literals instead of referring to previously defined constants, e. g.PhysicalConstants.jl/src/codata2018.jl
Lines 47 to 48 in 7d94def
PhysicalConstants.jl/src/codata2018.jl
Lines 80 to 81 in 7d94def
PhysicalConstants.jl/src/codata2018.jl
Lines 87 to 88 in 7d94def
This PR fixes the macro hygiene issues and changes these constant definitions to avoid unnecessary hard-coded values. I’ve checked that the resulting
Float64
values are the same as those that were previously hard-coded.