Currently the language syntax is specially made for the zig parser and zig build system. I want to propose adding meta data to functions and structs (maybe also global variables but I leave that to the zig team) with options in the zig parser to read them. Taking inspiration from clojure metadata.
Expected usage:
- add the documentation comments to the meta data.
- give the community a jump start to make analysis software like if a function calls any non thread safe function or check if upgrading dependency would use a deprecated function
- if the zig team decides to make meta data extensible, community could define extra tags in the future like fine grain policy management (uses network)
Expected Problems:
- adds overhead and memory usage in the parsing stage and will degrade the speed
- if the zig team decides to make meta data extensible, it adds complexity to the implementation.
- is callconv a meta data or part of the function declaration? someone needs to decide
- breaking syntax. I think a function being public if part of the meta data so should ‘pub’ be removed?
- what syntax to use? I think clojure syntax is simple, has little clutter (in clojure) and doesn’t interfere with zig existing syntax (I am talking about adding ^{} for meta data before keyword, fn and struct) but I am biased
Finally I am simply trying to leverage the zig parse more because it is very fast and well built to give the community power to create better tools.