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

running code at compile time macro #18

Closed
andrewrk opened this issue Dec 11, 2015 · 1 comment
Closed

running code at compile time macro #18

andrewrk opened this issue Dec 11, 2015 · 1 comment
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase.

Comments

@andrewrk
Copy link
Member

No description provided.

@andrewrk andrewrk added the enhancement Solving this issue will likely involve adding new logic or components to the codebase. label Dec 11, 2015
@andrewrk
Copy link
Member Author

This idea was inspired by Jonathan Blow's language but I'm fairly confident in my decision now that we will not have a macro to run code at compile time.

Instead, Zig will have a build.zig file which replaces configure / cmake / gyp / ninja / make etc. This file is executed at compile time and creates the build description. Where in most projects the thing you do is configure, make, make install, with zig projects it will be:

zig build [args] (executes build.zig)
zig build --install [args] (again executes build.zig)

build.zig will import a library to assist in common tasks such as building zig executables, libraries, and shared objects. The library will also assist in other common tasks such as building C/C++ code and executing arbitrary commands.

So if you wanted to run code at compile time, no problem, just have build.zig import that code, run it, potentially save the output to another .zig file, and then import that in your other file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Projects
None yet
Development

No branches or pull requests

1 participant