|
Boost : |
From: Hadriel Kaplan (hadrielk_at_[hidden])
Date: 2020-09-22 03:46:34
Howdy,
I vote to ACCEPT Boost.JSON into boost. I think itâs a fine implementation for what itâs intended for.
I donât understand some of the other reviews that reject it for not being something else - they got an apple and are complaining itâs the wrong color for an orange.
Itâs fine to prefer oranges over apples, but itâs also ok to offer apples for sale in your store even if you wouldnât buy it yourself. A lot of people like apples - theyâre simple and convenient, without having to peel away the layers of complexity involved in something more pulpy. (Ok, Iâve squeezed as much juice out of that metaphor as possible...)
- What is your evaluation of the design?
Good. It took me a bit to get used to it, because I was used to something else (Facebookâs folly::dynamic mostly); but that would be true of any new library.
- What is your evaluation of the implementation?
I didnât study the internal details. I used it as a consumer of the library. I thought the user-facing API was reasonable. The one change I made to the code was to force it to use std::string_view instead of boost::string_view, even though I used it in non-standalone mode. It would be nice if there were a separate compile flag for that, but itâs not a big deal.
Having yet another custom/purpose-built string implementation was surprising. Itâs not an issue, but just surprising that yet another string type is being created.
It was also a bit surprising there wasnât a function to pretty-print the serialized output (e..g, via an option arg for `serialize()`). Itâs fairly common to need such a thing, for example to write to user-viewable files (e.g., configuration or property files), and potentially to debug logs, etc. Obviously the user can write a pretty-printer of their own, but this is one of those things that I think should come out-of-the-box eventually.
- What is your evaluation of the documentation?
Very good. As a consumer, it had most everything I needed.
- What is your evaluation of the potential usefulness of the library?
I think itâs very useful.
Whether it will become _popular_ I donât know. Thereâs no debate there is high demand for a JSON-based variant-structure library similar to Boost.JSON, but there are several popular choices already. Boost.JSON has better performance and memory usage than some of the ones I know of (nlohman and folly::dynamic), so that should give it a leg up. But those libraries also have a lot of bells and whistles, and itâs not clear how much that will matter to people.
While my company also has a custom implementation for some specific uses, we do still use folly::dynamic fairly heavily, and I would seriously consider migrating to Boost.JSON in our code-base instead.
- Did you try to use the library?
Yes, I used it in non-standalone mode, and ran it through some tests we have in my employerâs code base.
- With which compiler(s)?
Gcc 7.3, C++17 mode.
- Did you have any problems?
Just a couple bugs that were quickly fixed by the authors.
One test failure I got was with the usage of scientific notation in serialized output, as has been noted by other reviewers. Itâs not _wrong_, of course, but itâs unusual - and unusual is frequently bad for interoperability.
Also, I first tried it in standalone and was surprised it didnât work even though we use C++17 - sadly, gcc 7.3 doesnât have the pmr::memory_resource implementation. Gcc doesnât have pmr until version 9+, which is a shame because incorporating it as standalone would be ideal; we do use boost heavily, but we almost always have issues when upgrading boost versions, so we donât upgrade often.
I think being usable as standalone would increase the uptake for Boost.JSON⦠but requiring gcc 9+ negates that somewhat, perhaps.
- How much effort did you put into your evaluation? A glance? A quick
reading? In-depth study?
I spent about a day testing it. Iâm sorry I didnât have more time this past week. Life happens. :(
- Are you knowledgeable about the problem domain?
Iâve been using `folly::dynamic` from Facebookâs folly library since 2014, and have made changes to it for my companyâs code base. It provides a similar variant-style structure based on JSON-ish types, with a parser and serializer for JSON encoding.
Iâve also written a custom JSON-based variant-structure for some of my companyâs particular needs, with built-in schema support, JsonPointer and XPath-style query support, etc.
-hadriel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk