Hi all,
I have a feature that I want to put behind a build Option. I’ve got it set up to have the Option working, but I want to have some fields in a struct only show up when the option is enabled.
In an imaginary zig language:
Ah, that makes sense. So if it is set to void it doesn’t take any space, but it would still show up in dev tooling, correct? (i.e. autocomplete, docs). If you want to set a default value, I would assume you would have to have some thing like this:
enable_feature_baz: if (config.enable_baz) bool else void = if (config.enable_baz) false else .{};
Basically putting the switching logic somewhere else and using your first version again. But I think it may be a good way to combine the two in some situations.
I think so, at least I have noticed that zls tends to pick one of the values and not always the one that is actually the right one. But I don’t really know what is going on with that in detail.