-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
Description
Currently, if a builtin function is added to the language, it is not possible to conditionally use it depending on the Zig version number:
const builtin = @import("builtin");
const introduced_new_thing = std.SemanticVersion.parse("0.12.0-dev.1377+3fc6fc681") catch unreachable;
const have_new_thing = builtin.zig_version.order(introduced_new_thing).compare(.gte));
fn example() void {
if (have_new_thing) {
@theNewBuiltin();
}
}Without this proposal, this code would cause older versions of the compiler to produce a compile error if a call to @theNewBuiltin was found anywhere in the file.
Not all such language changes can be accounted for by checking the version number, however, many of them can, and I think adding builtins should be one of them.
However, the downside here is that bad builtin calls in dead code would no longer be reportable.
jayschwa
Metadata
Metadata
Assignees
Labels
proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.