Toggling explicit struct initialization per struct via attribute #1605
Labels
Discussion needed
This feature needs discussion to iron out details
Enhancement Request
New feature or request
Milestone
ZII is perfect for some tasks, but sometimes I know that given struct is always initialized. So, adding new fields to a struct definition adds possibility of breaking this guarantee as uninitialized fields can go unnoticed. It is possible to overcome this using initialization functions, but I find that it becomes necessity for such structs, makes those functions constructor-like. I also enjoy using struct initialization when possible.
As a solution, an attribute can be added for each struct initialization literal (pardon the term if wrong).
Struct definition (nothing special here):
Expression:
Attribute at initialization location would allow same struct to be used with both ZII fields and explicit initialization, while preventing hard to follow bugs within big codebases.
The text was updated successfully, but these errors were encountered: