std.data.json formal review

Sönke Ludwig via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 29 12:43:58 PDT 2015


Am 29.07.2015 um 20:21 schrieb matovitch:
> Hi Sonke,
>
> Great to see your module moving towards phobos inclusion (I have not
> been following the latest progress of D sadly :() ! Just a small remark
> from the documentation example.
>
> Maybe it would be better to replace :
>
>      value.toJSONString!true()
>
> by
>
>      value.toJSONString!prettify()
>
> using a well-named enum instead of a boolean which could seem obscure I
> now Eigen C++ lib use a similar thing for static vs dynamic matrix.
>
> Thanks for the read. Regards,
>
> matovitch

Hm, that example is outdated, I'll fix it ASAP. Currently it uses toJSON 
and a separate toPrettyJSON function. An obvious alternative would be to 
add an entry GeneratorOptions.prettify, because toJSON already takes 
that as a template argument: toJSON!(GeneratorOptions.prettify)


More information about the Digitalmars-d mailing list