Unifying container (struc/enum/union) and function definition syntax #2873
Labels
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
I had this idea initially in #2859, but I think it better to put it in a dedicated issue.
There are 5 types of "containers" in zig: 1:
struct
, 2:enum
, 3:union
, 4:error
, and 5: file.Of these, all containers (except files) may be instanced, so the containers have some instance members and some namespace members. Since the current syntax for defining instance members looks very much alike defining parameters in a function, why not make container syntax more like the existing function syntax?
Rationale:
One downside is that there will be two (possibly multi-line) scopes for each single container, which creates some visual noise.
The text was updated successfully, but these errors were encountered: