-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Output zig targets
as ZON instead of JSON
#22939
Conversation
I guess this makes sense, though I'll be a little sad to see |
I feel bad changing this, but I don't know why I named them this way in the first place. Begin/end is consistent with the json API, and with other APIs in the wild that follow this pattern. Better to change now than later.
2b47432
to
c4a1cce
Compare
Hmm. If this reduces the utility of (The changes to stringify.zig should probably make it in for 0.14 regardless, if we decide not to make this change I'm happy to pull them out.) |
Why not just have both? Put json behind a |
Implemented very basic querying: https://codeberg.org/tensorush/zq Examples (when run in $ zig build exe -- -f build.zig.zon .name
"zq" $ cat build.zig.zon | zig build exe -- .dependencies.clap
.url = "git+https://github.com/Hejsil/zig-clap#e730233775300c0a8fe3137af880c7c58340930f"
.hash = "12205ef27929fba18101750677ff579c0b6aff670755cacbbe6f2bc5f073622e1783"
zig targets | zq .libc UPD: I decided to preserve original ZON value formatting, in order to tell values apart (e.g. |
@tensorush nice, this looks very useful! |
What is the rationale for using ZON instead of JSON? Thanks. |
This change grates on me for two reasons. As mentioned, this is a breaking change with no rational, other than "Not invented here." But second, because JSON is valuable as a data interoperability format. Even if ZON is suitable for serialization and deserialization, and even if it's nicer to work with from the perspective of the Zig programmer, I don't see it ever competing with JSON as a ubiquitous data exchange language. And I didn't think that was a goal. For programmatic output that is meant to be consumed by other tools, it makes sense to use a data format that is easy for those tools to understand. Edit: This is a drive-by critical comment in an unimportant part of the compiler, so I just want to also say thanks to the Zig team for their work towards 0.14 and thanks to @MasonRemaley for their work on ZON. |
The rationale is to promote zon as a data interchange format. It's also nice to remove json dependency from the compiler. |
As well as outputting ZON instead of JSON, this PR:
start*
/finish*
tobegin*
/end*
in stringifyI verified the output by diffing it with the JSON and glancing over it, and checking that it parses as ZON with the runtime parser.
The compile time parser on #22907 crashes on it right now, this is a bug there looking into it on that branch.(fixed)