Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add :single module compile time flag #15425

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ysbaddaden
Copy link
Contributor

@ysbaddaden ysbaddaden commented Feb 6, 2025

Just like the :release flag it can be useful to know during macros if we're compiling to a single module.

For example alongside the Linkage annotation, we would be able to mark the __crystal_* functions as internal only when compiling to a single module. For example:

{% if flag?(:single_module) %} @[Linkage("internal")] {% end %}
fun __crystal_once_init : Nil
end

Related to #15426

also uses a specific name to not override the `#single_module?`
accessor (used to clone a host compiler for macro runs).
This isn't neded, and it's always overriden by the call to
`compiler.release!` a few lines below anyway.
The object now has methods to set cross compiler and add emit targets;
they're responsible from enabling the single module property.

We thus no longer need the two query methods.
@straight-shoota straight-shoota modified the milestone: 1.16.0 Feb 7, 2025
@straight-shoota
Copy link
Member

#15439 addresses the primary motivation related to #921 (in conjuction with #15426).

This places a bit of a questionmark on the necessesity of the single_module flag. At least we should take some time to reconsider this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants