Proposal: ability to set type name directly in containers. #2515
Labels
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
Zig's ability to generate new types at comptime is an incredibly useful tool, however, in all but the simplest of cases it quickly leads to unreadable type names:
I've personally seen recursively generated types with names several lines long. As one of zig's fundamental tenants is readability and clarity, it would be useful to clean these up. It is unlikely that the compiler can make decisions in this regard that will be adequate for all use cases.
I propose allowing the programmer to set the type name directly from within the container's scope. Let us imagine a new builtin:
@setTypeName(comptime name: []const u8)
.Would then display as:
Drawbacks that spring immediately to mind are that this increases the risk of naming conflicts, and could obscure the source of the type.
The text was updated successfully, but these errors were encountered: