The dub documentation is now on dub.pm

Seb seb at wilzba.ch
Thu Jul 19 13:51:25 UTC 2018


On Thursday, 19 July 2018 at 13:10:01 UTC, Martin Tschierschke 
wrote:
> There should be a big section for well done dub.sdl / dub.json 
> examples.

Yes, there should be!
As always it just requires someone to step up, collect and add 
these examples.
FWIW the dub and vibe.d repositories both contain a great 
selection of dub.sdl examples.

> What about defining "comment" as an special keyword for the 
> .json parser inside Dub
> (just ignoring the content") to allow some kind comments inside 
> .json
> In the moment only dub.sdl may be more descriptive with 
> #comments.

It's // or /* ... */ in dub.sdl ;-)

> But many people prefer .json  where no comments are build in.
>
> So allow to write "comment" : "This string will will be parsed 
> away",
>  may do the difference?

As you mentioned SDL already supports comments. JSON support was 
actually only added because too many people complained about SDL 
not being properly supported.
Modifying the JSON parser is a bad idea as it will make 
integration with other tools harder.
Actually the JSON parser already accepts dub.json files with a 
trailing comma which isn't valid JSON and has thus already 
resulted in a bit of pain for tool authors as they can't use an 
off-the-shelf JSON parser anymore.
Currently, dub.json doesn't complain about unused fields (see 
https://run.dlang.io/is/2bbrN8), so you can already do the 
"comment" hack and if/once we actually check for valid field 
names, 'comment' could then be ignored.


More information about the Digitalmars-d-announce mailing list