Skip to content

v4.0.0

Compare
Choose a tag to compare
@stephenberry stephenberry released this 31 Oct 14:43
· 202 commits to main since this release

Glaze 4.0

This release brings a number of bug fixes with very few API breaking changes. The primary breaking change is a new integer parsing algorithm that is faster and rejects decimals and negative exponents to avoid implicit data loss.

New Integer Parsing Logic

When parsing integer types such as uint16_t or int64_t, Glaze will now reject decimal values and negative exponents, so a value such as 1.37 would produce a parse_number_failure. This is important for avoiding implicit data loss. Developers often need to handle these conversions in various ways. Sometimes it is better to round (with various methodologies), other times truncate, and other times use the ceiling. It is recommended to use floating point types if you do not know if you will be receiving decimal values. A glz::custom lambda in your meta can be used to invisibly convert a parsed floating point value into an integer if you do not wish to do this elsewhere.

We are open to requests for additional integer parsing options, but don't want to add complexity to Glaze unless there is a concrete need. So, please open an issue if this change causes problems.

By narrowing the definition of what it means to parse an integer in Glaze it will allow us to perform variant type deduction on integer vs floating point types. So, we will be able to parse either into an integer or a float in a variant. This has been requested a few times and would allow interfaces to avoid data loss with large integers and floating point decimal values simultaneously.

In summary, this change in integer parsing provides the benefits:

  • Faster integer parsing
  • No implicit data loss
  • Disambiguation of integers and floats in JSON parsing to support dual integer/float types in variants and full numeric integrity

Positive exponents are still handled for integer parsing, such as 1e9, which can save space and be easier to read than 1000000000.

This release has no effect on integer serialization. Round-tripping in Glaze has not been affected.

Breaking Changes

  • String support for std::array<char, N> in #1247
    std::array<char, N> is now treated as a string type rather than an array of single character strings.

  • Roundtrip support for vector<pair>, better concatenate option support, and BEVE support for these in #1418
    When reading in a vector<pair> type objects are by default expected to be concatenated (as they are for output). The concatenate option must be set to false to read in a non-concatenated vector of pairs. Now both the concatenate = true and concatenate = false conditions properly roundtrip for both JSON and BEVE.

Improvements

  • json_t assignment operators and string_view constructor in #1412
  • Support for std::atomic in #1364
  • Use clang format 18.1 in #1374
  • Use jkj::dragonbox::to_decimal_ex for faster floating point serialization in #1392
  • Adding roundtrip format agnostic testing in #1380
  • Type "cls" or "clear" to bring the command line menu (glz::cli_menu) to the front in #1409

Fixes

  • Removing lots of noexcept qualifiers to allow exceptions to propagate when Glaze is used with exceptions enabled in #1420
  • Unknown fields fix with entirely null first object in #1367
  • [Concept update] string_t with resize also needs to have .data() by @sjanel in #1372
  • Support empty input NDJSON in #1381
  • Fix JSON RPC documentation link to json-rpc.cpp source by @pentatonick in #1385
  • Support reading into a const pointer to a member in #1387
  • Fix JSON parsing from arrays to set like types with custom structs by @sjanel in #1394
  • Put fast_float and dragonbox into glz namespace by @amosbird in #1398
  • Naming more things beve instead of binary in #1399
  • Using GLZ_ macro prefix for third party dependencies by @stephenberry in #1403
  • Add missing include inside of threadpool.hpp by @X-rays5 in #1413

Active Development (use at your own risk)

  • New binary REPE v1.0 spec implementation (repe::registry) in #1336
  • Capture functions by reference in repe::registry by @stephenberry in #1396
  • Removing repe::registry auto-locking in #1415

Full Changelog: v3.6.2...v4.0.0