dub: JSON, SDL, YAML, TOML, what color should we paint it ?

Petar Petar
Fri Mar 3 18:44:54 UTC 2023


On Friday, 3 March 2023 at 17:14:45 UTC, 0xEAB wrote:
> [..]
> I’ve been using DUB for years, and still can’t remember SDL’s 
> syntax.

The same applies to Dub's json format. I doubt many people can 
write a complicated dub.json file (e.g. with various 
configurations, platform & compiler specific D or LD flags, 
optional dependencies, git depedencies, and so on) without 
looking up the docs, or more likely browsing other D projects for 
inspiration.

> [..]
>
> Also, I’m curious:
> Does anyone here in the community use it for anything else but 
> DUB recipes?

Back in 2014 I was writing a toy ray tracer for a university 
project. Initially, I started using JSON for describing scenes, 
since it seemed like the obvious choice (and `std.json` among 
another things). Not long after I started the project I quickly 
got annoyed with JSON's lack of expressiveness(especially coming 
using [XAML][1] at work), and its lack of comments. Not long 
after I had started the project I learned that Dub was adding SDL 
format and I read [DEP1][2] which convinced me to try and 
experiment with SDL. Then I gave it a go and extended my scene 
loader so it could load SDL (in addition to JSON) files. In the 
end, I liked the result, so I stuck with it. As I said, that was 
a toy project, so I don't have anything particularly interesting 
to show, but still, you may be curious to see an example of 
another D project using SDL as a human-readable data format:
https://github.com/PetarKirov/Chess2RT/blob/master/data/lecture5.sdl

[1]: 
https://learn.microsoft.com/en-us/dotnet/desktop/wpf/xaml/?view=netdesktop-7.0
[2]: https://github.com/dlang/dub/wiki/DEP1


More information about the Digitalmars-d mailing list