-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
proposal: instead of build.zig.ini, use build.zig.zon #14290
Comments
Ok, this isn't quite as bad as I was expecting. Though of course we'd have to provide a reference parser to be taken seriously, and if we write that in Zig, we'd have to make sure it itself has no dependencies. Also I think removing the dot from dotbrace really would cause parsing problems. Is |
Maybe I missed something but what is the main profit of using this own DSL (not supported by any tool)? In yaml: name: libffmpeg
version: 5.1.2
dependencies:
libz:
url: https://github.com/andrewrk/libz/archive/f0e53cc2391741034b144a2c2076ed8a9937b29b.tar.gz
hash: c9b30cffc40999d2c078ff350cbcee642970a224fe123c756d0892f876cf1aae
libmp3lame:
url: https://github.com/andrewrk/libmp3lame/archive/497568e670bfeb14ab6ef47fb6459a2251358e43.tar.gz
hash: 9ba4f49895b174a3f918d489238acbc146bd393575062b2e3be33488b688e36f |
@deflock In short, no existing tool satisfies all our requirements. For more detail, see the linked PR. |
YAML is too complicated and has unacceptable footguns. |
@EleanorNB I've scrolled one more time and I see why json/csv do not satisfy, s-expressions in imperative language is a bit weird :) So remaining candidates are toml, yaml, own format. I see only one profit of using own format - if it will be used directly within |
@deflock that's a nice point in favor of this proposal that I hadn't considered - similar to how in node.js you can |
Another point in favor of this proposal over the TOML one: #14291. Note how line diffs against mirrors field (an array) would be annoying in the TOML case due to both elements being on the same line. |
I think this is much better than TOML subset. Upsides:
Downsides:
Please, don't use YAML, every time I work with that, I lose my sanity over some weird thing |
why do we have this .dependencies = .{
.libz = .{
.url = "https://github.com/andrewrk/libz/archive/f0e53cc2391741034b144a2c2076ed8a9937b29b.tar.gz",
.hash = "c9b30cffc40999d2c078ff350cbcee642970a224fe123c756d0892f876cf1aae",
}, instead of this? .dependencies = .{
.{
.name = "libz",
.url = "https://github.com/andrewrk/libz/archive/f0e53cc2391741034b144a2c2076ed8a9937b29b.tar.gz",
.hash = "c9b30cffc40999d2c078ff350cbcee642970a224fe123c756d0892f876cf1aae",
}, does the former actually work in Zig if there's no struct with a I would also like to vote against the name "lulz", as that word is often associated with mob harassment and racism. |
Alright fine, I changed the proposal to the much more conservative and obvious choice of |
Alright, enough deliberation. Moving forward with this one; rejecting #14289. |
This reminds me of https://github.com/ron-rs/ron. |
That wouldn't be a problem as ZON is a data format, and we only need We don't need to execute that here. But imho, for the sake of consistency, i'd prefer @thejoshwolfe: I actually prefer |
I proposed #14265 (comment), this proposal alignes to my needs, more or less idea I envisioned. I upvote for them. The only thing I dislike is
It looks and feels very much like improved JSON format. Very structered and understandable, but with comments. |
Zon of a gun, this is brilliant ❤️ Will comments be |
With the ini format you could have duplicate
While I agree that the syntax is nicer, I also believe that if a Zig data format is chosen, it makes sense that the schema can be described by a Zig type and that the data can be loaded directly into said type. Using the key syntax to describe a dynamic map kinda loses both of those properties |
At first I thought this was a new format with a subset of features of normal Zig but as far as I understand it it's just a regular Zig file with a single struct expression that can be imported, which I like very much.
IMO If however this is actually supposed to be a new format with only a subset of features of normal Zig, why? Why do we need to create a new format when a normal Zig file could also contain this struct expression listing the packages? |
An advantage of build.zig.zon is that the file would always show up next to build.zig in listings sorted by file name. |
package.zon for defining package and direct (top-level) dependencies, package.lock.zon for fixed transitive (non-direct) dependencies, generated and maintained by package manager only. Let's reuse knowledge of other package managers (npm as most advanced) which already faced with all kind of subtle bugs and errors. |
@likern we shouldn't blindly copy other package managers. Looking at their decisions and why they were made is a good idea, but package managers like cargo, npm, etc. were not designed for Zig and differ quite a lot from Zig's package manager. |
Possibly cursed question: If .zon has the leading |
@michaelbartnett I think for that you'd use a union-style |
Probably most similar in design to what Zig attempts to do (both with the build.zig file and the proposal for .zon to be a zig-ish (if not actually valid zig) is the Swift Package Manager might be some interesting ideas in there. |
@tpmoney I feel the same way about the Swift Package Manager format, and Erlang's configuration file also has very similar design, which is a subset of erlang syntax |
With all that functionality sooner or later we might need some I think like for 95-99% of packages |
@likern The whole point of zon is to not execute arbitrary code. See #14290 (comment) and #14290 (comment) |
* improve error message when build manifest file is missing * update std.zig.Ast to support ZON * Compilation.AllErrors.Message: make the notes field a const slice * move build manifest parsing logic into src/Manifest.zig and add more checks, and make the checks integrate into the standard error reporting code so that reported errors look sexy closes #14290
* improve error message when build manifest file is missing * update std.zig.Ast to support ZON * Compilation.AllErrors.Message: make the notes field a const slice * move build manifest parsing logic into src/Manifest.zig and add more checks, and make the checks integrate into the standard error reporting code so that reported errors look sexy closes #14290
What about “Zig Attribute Grammar”? |
ziglang/zig#14290 Co-authored-by: Alexander Courtis <[email protected]>
ziglang/zig#14290 This is the official file ending of zon files, at the time of writing this only used to specify dependencies, versions and files of zig packages
ziglang/zig#14290 This is the official file ending of zon files, at the time of writing this only used to specify dependencies, versions and files of zig packages
Extracted from #14265.
Zig Object Notation
Instead of...
It would look like this:
It also should be renamed with the
.zon
extension, and furthermore,[package]
should be renamed to[project]
to match the correct terminology.Perhaps the
.
in Zig language itself should be removed, and then it could be like this:which is pretty unoffensive if you ask me. Lots of people hate that dot anyway. I don't know if the parsing would be problematic or not though, would need to investigate.
See competing proposal:
The text was updated successfully, but these errors were encountered: