feat!: error on non-DSL pub fn in exportModule#38
Merged
Conversation
Zig functions are skipped if they: 1) are not `pub fn`, 2) do not use DSL-compatible types from the `js` module We can't error since we want flexibility to define and use other functions in the same file, so we just add a simple warning to warn the user about this at comptime. This is to avoid future situations encountered here: ChainSafe/lodestar-z#371
Contributor
|
Problem with simple warning is that binding author might not notice it at all, as most of the time there will some CI workflow building buildings, not a human looking at build warnings. And then for binding consumer that warning will be too late to address any solution. |
nazarhussain
approved these changes
May 26, 2026
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.
js.exportModulepreviously silently droppedpub fns whose parameters weren't DSL-compatible. That made it easy to ship a function you thought was exported but wasn't (see ChainSafe/lodestar-z#371).Now
exportModuleraises a@compileErrornaming the offending decl.Fix it by one of:
js.Number),pubif the function is a helper not meant for JS,.registertojs.exportModuleto export the function manually.BREAKING CHANGE
Modules with non-DSL
pub fns alongside DSL exports will no longer build.