Don't accidentally extend implicit eval function#21
Open
Keno wants to merge 1 commit intophelipe:masterfrom
Open
Don't accidentally extend implicit eval function#21Keno wants to merge 1 commit intophelipe:masterfrom
eval function#21Keno wants to merge 1 commit intophelipe:masterfrom
Conversation
This package uses the name `eval`, which is ordinarily reserved for the implicitly provided `eval` function provided by the core system. Adding methods to this generic function worked accidentally due to the way the implementation works, but is probably neither what you want nor guarateed to keep working (e.g. JuliaLang/julia#55949 would break it if merged). To address the issue, make `Fuzzy` a baremodule to avoid implicitly creating the `include`/`eval` names and then add back explicit imports of Base and a definition of `include`. This way, `Fuzzy.eval` is completely decoupled from the core notion of `eval`.
Keno
added a commit
to Keno/JUDI.jl
that referenced
this pull request
Oct 17, 2024
The `eval` and `include` generic functions are implicitly provided by `module` for every new julia module. Currently it is possible to extend these (somewhat by accident), but this might change in JuliaLang/julia#55949. To avoid that causing issues, this renames the `eval` method in this package to `eval_lazy` to avoid accidentally extending the builtin. If desireed, you could instead use a baremodule to avoid creating the implicit functions (see e.g. phelipe/Fuzzy.jl#21). While I'm here, also strength-reduce the (builtin) `eval` method to `getproperty` instead as applicable. This is not required, but simply a best practice to avoid requiring the full semantics of `eval` (which include arbitrary code execution) when it is not needed. I was unable to test this locally due to some python dependency errors, so please take a careful look to make sure I got this right.
This was referenced Oct 17, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This package uses the name
eval, which is ordinarily reserved for the implicitly providedevalfunction provided by the core system. Adding methods to this generic function worked accidentally due to the way the implementation works, but is probably neither what you want nor guarateed to keep working (e.g. JuliaLang/julia#55949 would break it if merged). To address the issue, makeFuzzya baremodule to avoid implicitly creating theinclude/evalnames and then add back explicit imports of Base and a definition ofinclude.This way,
Fuzzy.evalis completely decoupled from the core notion ofeval.