www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DUB: json or sdl?

reply Ki Rill <rill.ki yahoo.com> writes:
Out of curiosity, which one do you use in your dub projects and 
why do you prefer one over another?

For example, I use json. Simply because when I see `sdl`, I think 
of `SDL2` graphics library.

What's your reason?
Sep 22
next sibling parent reply drug <drug2004 bk.ru> writes:
22.09.2021 13:19, Ki Rill пишет:
 Out of curiosity, which one do you use in your dub projects and why do 
 you prefer one over another?
 
 For example, I use json. Simply because when I see `sdl`, I think of 
 `SDL2` graphics library.
 
 What's your reason?
My reason for sdl format using is its conciseness, human readability and possibility of comments. P.S. I remember that very long negative thread about sdl format by default and how it was funny when the thread starter agreed later that sdl was much convenient that json.
Sep 22
parent deadalnix <deadalnix gmail.com> writes:
On Wednesday, 22 September 2021 at 10:29:58 UTC, drug wrote:
 My reason for sdl format using is its conciseness, human 
 readability and possibility of comments.
And this is why I use json parser that accept comments :)
Sep 22
prev sibling next sibling parent reply bauss <jj_1337 live.dk> writes:
On Wednesday, 22 September 2021 at 10:19:18 UTC, Ki Rill wrote:
 Out of curiosity, which one do you use in your dub projects and 
 why do you prefer one over another?

 For example, I use json. Simply because when I see `sdl`, I 
 think of `SDL2` graphics library.

 What's your reason?
Json because it's a consistent format across environments outside of D, unlike sdl which is basically only used by D and only by dub really.
Sep 22
parent reply Tobias Pankrath <tobias pankrath.net> writes:
On Wednesday, 22 September 2021 at 10:45:41 UTC, bauss wrote:

 Json because it's a consistent format across environments 
 outside of D, unlike sdl which is basically only used by D and 
 only by dub really.
I use it on the job (not a D shop).
Sep 22
parent reply russhy <russhy gmail.com> writes:
i hate json, but that's the format i use

i wish we could just use a ``build.d`` file, so we can have more 
control and stick to using D
Sep 22
next sibling parent Kagamin <spam here.lot> writes:
On Wednesday, 22 September 2021 at 21:25:11 UTC, russhy wrote:
 i hate json, but that's the format i use

 i wish we could just use a ``build.d`` file, so we can have 
 more control and stick to using D
I would go with most simple syntax for simple builds - a command line syntax, where each command is a list of tokens separated by whitespace, the earlier example: ``` dependency sumtype 0.10.0 dflags -betterC -dip1000 ``` and just fall back to D for complex builds, maybe with reggae api.
Sep 23
prev sibling parent Kagamin <spam here.lot> writes:
On Wednesday, 22 September 2021 at 21:25:11 UTC, russhy wrote:
 i hate json, but that's the format i use

 i wish we could just use a ``build.d`` file, so we can have 
 more control and stick to using D
I would go with most simple syntax for simple builds - a command line syntax, where each command is a list of tokens separated by whitespace, the earlier example: ``` dependency sumtype 0.10.0 dflags -betterC -dip1000 ``` and just fall back to D for complex builds, maybe with reggae api.
Sep 23
prev sibling next sibling parent jfondren <julian.fondren gmail.com> writes:
On Wednesday, 22 September 2021 at 10:19:18 UTC, Ki Rill wrote:
 Out of curiosity, which one do you use in your dub projects and 
 why do you prefer one over another?

 For example, I use json. Simply because when I see `sdl`, I 
 think of `SDL2` graphics library.

 What's your reason?
Reason to prefer JSON: 1. dub is stricter about the format, and will complain about errors for SDL would result in values being silently ignored. 2. you want something like a 2008 Perl install to be able to do something with your dub.json files, instead of writing a D program. 3. you hope that a glacier of increasing dub.json files will eventually tear out the roots of dub having more than one config format 4. you have a phobia about malicious comments getting injected into your dub.sdl files 5. you used jq and liked it to the point of finding other formats intolerable Reasons to prefer SDL: 1. comments in dub.sdl files, 2. ```d /+ dub.json: { "dependencies": { "sumtype": "~>0.10.0", }, "dflags": ["-betterC"], } +/ vs. /+ dub.sdl: dependency "sumtype" version="~>0.10.0" dflags "-betterC" +/ ``` dub converts SDL to JSON for ~/.packages/ , and the same code might be used to convert SDL documentation to JSON, so I think the main problem of multiple dub configuration formats (that it's more of a chore to talk about dub configuration) is not that bad.
 On Wednesday, 22 September 2021 at 10:45:41 UTC, bauss wrote:
 Json because it's a consistent format across environments 
 outside of D, unlike sdl which is basically only used by D and 
 only by dub really.
With JSON you do not have to remember what an array or a hash looks like, but that doesn't tell you that the `"dflags"` key has an array of strings rather than looking like `"dflags": "-betterC",` You have to look up what dub expects either way, so the consistency fails to help with the most frustrating part of dub configurations, which is writing them in the first place.
Sep 22
prev sibling next sibling parent reply Mike Parker <aldacron gmail.com> writes:
On Wednesday, 22 September 2021 at 10:19:18 UTC, Ki Rill wrote:
 Out of curiosity, which one do you use in your dub projects and 
 why do you prefer one over another?

 For example, I use json. Simply because when I see `sdl`, I 
 think of `SDL2` graphics library.

 What's your reason?
SDL. It's much cleaner to me than JSON. And the fact that JSON is standard elsewhere matters not one iota to me.
Sep 22
parent reply Ki Rill <rill.ki yahoo.com> writes:
On Wednesday, 22 September 2021 at 13:22:33 UTC, Mike Parker 
wrote:
 On Wednesday, 22 September 2021 at 10:19:18 UTC, Ki Rill wrote:
 Out of curiosity, which one do you use in your dub projects 
 and why do you prefer one over another?

 For example, I use json. Simply because when I see `sdl`, I 
 think of `SDL2` graphics library.

 What's your reason?
SDL. It's much cleaner to me than JSON. And the fact that JSON is standard elsewhere matters not one iota to me.
What do you think of Rust's `toml` format?
Sep 22
next sibling parent Mike Parker <aldacron gmail.com> writes:
On Wednesday, 22 September 2021 at 14:57:09 UTC, Ki Rill wrote:
 On Wednesday, 22 September 2021 at 13:22:33 UTC, Mike
 SDL. It's much cleaner to me than JSON. And the fact that JSON 
 is standard elsewhere matters not one iota to me.
What do you think of Rust's `toml` format?
Looks readable. Never used it though, so I don't know how it is to write.
Sep 22
prev sibling next sibling parent Elronnd <elronnd elronnd.net> writes:
On Wednesday, 22 September 2021 at 14:57:09 UTC, Ki Rill wrote:
 What do you think of Rust's `toml` format?
It's not 'rust's'; it's a general-purpose standardisation of INI which happens to be used by cargo. IMO it's an excellent format for flat data, not so much for nested data.
Sep 22
prev sibling parent guai <guai inbox.ru> writes:
On Wednesday, 22 September 2021 at 14:57:09 UTC, Ki Rill wrote:
 What do you think of Rust's `toml` format?
It is inconsistent in its own rules and cannot be used as a drop-in replacement for JSON and other regular formats So, meh
Oct 01
prev sibling next sibling parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 9/22/21 6:19 AM, Ki Rill wrote:
 Out of curiosity, which one do you use in your dub projects and why do 
 you prefer one over another?
 
 For example, I use json. Simply because when I see `sdl`, I think of 
 `SDL2` graphics library.
 
 What's your reason?
I actually used to prefer sdl, but lately, I'm using json. sdl is an ok format to write, but I always forget the way to write arrays or objects. With json I always know what I need to use. I prefer a comment-allowing form, especially for config files, where comments can provide instructions on what directives do. Having dub init spit out a bunch of comments that describe how to configure dub, and how to add dependencies, configs, etc, would go a long way to making it not as bad a format. -Steve
Sep 22
parent reply Ki Rill <rill.ki yahoo.com> writes:
On Wednesday, 22 September 2021 at 14:15:43 UTC, Steven 
Schveighoffer wrote:
 I prefer a comment-allowing form, especially for config files, 
 where comments can provide instructions on what directives do. 
 Having dub init spit out a bunch of comments that describe how 
 to configure dub, and how to add dependencies, configs, etc, 
 would go a long way to making it not as bad a format.

 -Steve
I wish `json` would accept comments. I prefer to leave lots of comments for future me in case I forget what I did, important information about a package, etc...
Sep 22
parent bauss <jj_1337 live.dk> writes:
On Wednesday, 22 September 2021 at 15:07:21 UTC, Ki Rill wrote:
 On Wednesday, 22 September 2021 at 14:15:43 UTC, Steven 
 Schveighoffer wrote:
 I prefer a comment-allowing form, especially for config files, 
 where comments can provide instructions on what directives do. 
 Having dub init spit out a bunch of comments that describe how 
 to configure dub, and how to add dependencies, configs, etc, 
 would go a long way to making it not as bad a format.

 -Steve
I wish `json` would accept comments. I prefer to leave lots of comments for future me in case I forget what I did, important information about a package, etc...
Json5 accepts comments
Sep 23
prev sibling next sibling parent JN <666total wp.pl> writes:
On Wednesday, 22 September 2021 at 10:19:18 UTC, Ki Rill wrote:
 Out of curiosity, which one do you use in your dub projects and 
 why do you prefer one over another?

 For example, I use json. Simply because when I see `sdl`, I 
 think of `SDL2` graphics library.

 What's your reason?
I use JSON. I am more familiar with JSON, never seen SDL used outside of dub and I find JSON cleaner.
Sep 22
prev sibling next sibling parent reply SealabJaster <sealabjaster gmail.com> writes:
On Wednesday, 22 September 2021 at 10:19:18 UTC, Ki Rill wrote:
 ...
SDL. It's cleaner and easier to read, and I have no use cases where external languages need to read a dub.json file. I agree that the acronym is unfortunate because of SDL2.
Sep 23
parent guai <guai inbox.ru> writes:
On Thursday, 23 September 2021 at 08:10:29 UTC, SealabJaster 
wrote:
 SDL. It's cleaner and easier to read, and I have no use cases 
 where external languages need to read a dub.json file.
second that
Oct 01
prev sibling next sibling parent Guillaume Piolat <first.last gmail.com> writes:
On Wednesday, 22 September 2021 at 10:19:18 UTC, Ki Rill wrote:
 Out of curiosity, which one do you use in your dub projects and 
 why do you prefer one over another?

 For example, I use json. Simply because when I see `sdl`, I 
 think of `SDL2` graphics library.

 What's your reason?
JSON. I have a build tool that parses dub.json to extract meta-data from the project. A good SDL parser didn't exist back then. As for TOML, its syntax for arrays is unfortunate, I don't feel like it's better than JSON (or even XML for what matters).
Sep 23
prev sibling next sibling parent Martin Tschierschke <mt smartdolphin.de> writes:
On Wednesday, 22 September 2021 at 10:19:18 UTC, Ki Rill wrote:
 Out of curiosity, which one do you use in your dub projects and 
 why do you prefer one over another?

 For example, I use json. Simply because when I see `sdl`, I 
 think of `SDL2` graphics library.

 What's your reason?
My thought about the missing comments: The DUB-parser of the .json files might just remove all "comment": "My comment" from the parsing result and we would have a way to place them. "comment": "List of authors is probably not complete" "authors": [ "Martin Tschierschke" ],
Sep 24
prev sibling next sibling parent reply Mathias LANG <geod24 gmail.com> writes:
On Wednesday, 22 September 2021 at 10:19:18 UTC, Ki Rill wrote:
 Out of curiosity, which one do you use in your dub projects and 
 why do you prefer one over another?

 For example, I use json. Simply because when I see `sdl`, I 
 think of `SDL2` graphics library.

 What's your reason?
I use `dub.json` because it is well-established and easier for people to get familiar with. I don't want to force people to learn yet another markup language to read our package definition. Well, that's not true... I would prefer to use yet another markup language (YAML) over JSON, because it's well-established, supports comments, and is a superset of JSON.
Sep 26
next sibling parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 9/26/21 7:58 PM, Mathias LANG wrote:

 Well, that's not true... I would prefer to use yet another markup 
 language (YAML) over JSON, because it's well-established, supports 
 comments, and is a superset of JSON.
YAML stands for "YAML Ain't Markup Language". Yeah, I was surprised too. -Steve
Sep 26
parent reply Meta <jared771 gmail.com> writes:
On Monday, 27 September 2021 at 00:30:52 UTC, Steven 
Schveighoffer wrote:
 On 9/26/21 7:58 PM, Mathias LANG wrote:

 Well, that's not true... I would prefer to use yet another 
 markup language (YAML) over JSON, because it's 
 well-established, supports comments, and is a superset of JSON.
YAML stands for "YAML Ain't Markup Language". Yeah, I was surprised too. -Steve
I thought it stood for "Yet Another Markup Language"?
Sep 27
next sibling parent Adam D Ruppe <destructionator gmail.com> writes:
On Monday, 27 September 2021 at 17:52:03 UTC, Meta wrote:
 I thought it stood for "Yet Another Markup Language"?
It used to but they changed it.
Sep 27
prev sibling parent bauss <jj_1337 live.dk> writes:
On Monday, 27 September 2021 at 17:52:03 UTC, Meta wrote:
 On Monday, 27 September 2021 at 00:30:52 UTC, Steven 
 Schveighoffer wrote:
 On 9/26/21 7:58 PM, Mathias LANG wrote:

 Well, that's not true... I would prefer to use yet another 
 markup language (YAML) over JSON, because it's 
 well-established, supports comments, and is a superset of 
 JSON.
YAML stands for "YAML Ain't Markup Language". Yeah, I was surprised too. -Steve
I thought it stood for "Yet Another Markup Language"?
https://en.wikipedia.org/wiki/YAML#History_and_name ``` Originally YAML was said to mean Yet Another Markup Language, because it was released in an era that saw a proliferation of markup languages for presentation and connectivity (HTML, XML, SGML, etc). Its initial name was intended as a tongue-in-cheek reference to the technology landscape, referencing its purpose as a markup language with the yet another construct, but it was then repurposed as YAML Ain't Markup Language, a recursive acronym, to distinguish its purpose as data-oriented, rather than document markup. ```
Oct 03
prev sibling parent Tejas <notrealemail gmail.com> writes:
On Sunday, 26 September 2021 at 23:58:23 UTC, Mathias LANG wrote:
 On Wednesday, 22 September 2021 at 10:19:18 UTC, Ki Rill wrote:
 Out of curiosity, which one do you use in your dub projects 
 and why do you prefer one over another?

 For example, I use json. Simply because when I see `sdl`, I 
 think of `SDL2` graphics library.

 What's your reason?
I use `dub.json` because it is well-established and easier for people to get familiar with. I don't want to force people to learn yet another markup language to read our package definition. Well, that's not true... I would prefer to use yet another markup language (YAML) over JSON, because it's well-established, supports comments, and is a superset of JSON.
You prefer YAML even over [JSON5](https://json5.org/)?
Sep 27
prev sibling next sibling parent Dga123 <Dga123 123.fi> writes:
On Wednesday, 22 September 2021 at 10:19:18 UTC, Ki Rill wrote:
 Out of curiosity, which one do you use in your dub projects and 
 why do you prefer one over another?

 For example, I use json. Simply because when I see `sdl`, I 
 think of `SDL2` graphics library.

 What's your reason?
- JSON for projects - SDL for embedded recipes, e.g script, because it's usally small (name + 1 or two dependencies) and looks less shocking than the JSON equivvalent in a comment on top of the module.
Sep 27
prev sibling next sibling parent Dukc <ajieskola gmail.com> writes:
On Wednesday, 22 September 2021 at 10:19:18 UTC, Ki Rill wrote:
 Out of curiosity, which one do you use in your dub projects and 
 why do you prefer one over another?

 For example, I use json. Simply because when I see `sdl`, I 
 think of `SDL2` graphics library.

 What's your reason?
I prefer SDL per se, but [dub2nix](https://github.com/lionello/dub2nix) currently requires JSON so I often end up using that. On the other hand I could use SDL as source format and transpile with dub when needed.
Sep 27
prev sibling parent Imperatorn <johan_forsberg_86 hotmail.com> writes:
On Wednesday, 22 September 2021 at 10:19:18 UTC, Ki Rill wrote:
 Out of curiosity, which one do you use in your dub projects and 
 why do you prefer one over another?

 For example, I use json. Simply because when I see `sdl`, I 
 think of `SDL2` graphics library.

 What's your reason?
json, but just because I'm used to it already. Kinda miss to be able to add comments though (in general)
Oct 05