Open
Conversation
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.
问题:
Problem:
有一个项目同时使用 pull 和 aleph。当我尝试将 aleph 升级到最新版时,打包运行项目会出现大量异常,提示找不到 sg.flybot.pullable.schema/check-pattern! 变量。
A project uses both pull and aleph. When I tried upgrading aleph to the latest version, running the packaged project produced a large number of exceptions indicating that the variable
sg.flybot.pullable.schema/check-pattern!could not be found.分析:
Analysis:
分析更新前后的打包结果,发现 sg.flybot.pullable/query 对应的 class 文件有变化:更新后的 class 文件中出现了 sg.flybot.pullable.schema/check-pattern! 文本,而更新前没有。
After comparing the packaged results before and after the upgrade, I found that the
sg.flybot.pullable/queryclass file had changed: in the new version, the class file contains the textsg.flybot.pullable.schema/check-pattern!, whereas the old version does not.推测是新版本的 aleph 引入的 malli 依赖导致的:在编译期,有副作用的宏函数加载了 sg.flybot.pullable.schema ns,导致宏展开的结果是使用了 sg.flybot.pullable.schema/check-pattern! 的分支,而编译期环境中也能找到对应的变量,因此可以把宏展开后的结果编译成 class 文件。但在运行期,没有调用有副作用的宏函数加载 sg.flybot.pullable.schema ns,导致找不到 sg.flybot.pullable.schema/check-pattern!。该问题只能在编译期和运行期分离的情景下才能复现。
I suspect that this is caused by the new version of aleph introducing a dependency on malli: during compilation, a macro function with side effects loads the
sg.flybot.pullable.schemanamespace. As a result, the macro expansion uses the branch referencingsg.flybot.pullable.schema/check-pattern!, and since the corresponding variable is available in the compile-time environment, the expanded form is successfully compiled into the class file. However, at runtime, the macro with side effects is not invoked, so thesg.flybot.pullable.schemanamespace is never loaded, leading to a missingsg.flybot.pullable.schema/check-pattern!variable. This issue only occurs in scenarios where the compile-time and runtime environments are separated.我更建议在运行期尝试加载并绑定 sg.flybot.pullable.schema/check-pattern!:
I recommend attempting to load and bind
sg.flybot.pullable.schema/check-pattern!at runtime instead: