On Mon, 21 Sep 2020 at 15:59, Peter Dimov
But if the value gets larger, the parser will not call on_uint64, it will call on_double.
I didn't see that in the implementation, but that doesn't really change my point (well at least it avoids having an undefined value, replaces it with an approximation instead). The value I gave is a valid uint64 value, but isn't a valid double. Adding one digit would neither make it a valid uint64 nor a valid double.
OK, if you don't need the text to binary conversion, what's stopping you from ignoring it, and only using the text part? You do get all the info, it's just that the final part doesn't arrive via "on_number", but via the other three callbacks, to save one call.
Separation of concerns, wasted cycles, etc. Parsing numbers is the slowest part of all this parsing business, and the part that's most dependent on how you want to represent numbers into memory. For example I typically represent numbers as decimals myself.