In Zig one can use @"this syntax" to name an identifier any arbitrary sequence of bytes, including keywords. The purpose of this is to allow interoperability with any C ABI names, even names that conflict with Zig keywords.
However one cannot do this with @"_" because this is semantically equivalent to _, because _ is an identifier, not a keyword. Meaning that Zig will treat @"_" just like _, not allowing variables and functions with this name. And thus it is impossible to have an external variable named _ even though that is legal in C.
This proposal is to change _ into a keyword. Although it's technically a breaking change, it shouldn't break anyone's code in practice, but it does require changes to the grammar and parser, e.g. to implement #1797.
One question I want to answer before deciding on this issue is whether the same should be done to all primitive types, including, for example, i32. It feels a bit strange, but I'm leaning towards yes. I'll note that this conflicts with #2926.
An alternative solution would be to add a linksymbol property to variables. Then you could just do:
var c_underscore linksymbol("_") = ...
After wasting a bunch of time coming up with alternatives to 'type' I'm starting to heavily lean in favor of turning _ and all primitive types into keywords.
Most helpful comment
An alternative solution would be to add a
linksymbolproperty to variables. Then you could just do: