yojson icon indicating copy to clipboard operation
yojson copied to clipboard

Idea: parsing option to emit only `Float values for numbers

Open cemerick opened this issue 6 years ago • 2 comments

Insofar as many (some?) applications consuming JSON are at peace with presuming floats everywhere (given the Javascript heritage), an option to only ever emit `Float values for numbers (and never `Ints) would be helpful to simplify pattern matching, etc.

cemerick avatar Jul 24 '19 15:07 cemerick

It could be done as another CPPO branch, like FloatSafe, though personally I am worried about the combinatorial explosion of different variants.

That said, it would maybe make sense to remove some of the unused variants for 2.0, if we're going to break compatibility in lots of tiny ways.

Leonidas-from-XIV avatar Dec 19 '19 17:12 Leonidas-from-XIV

Having converters from one AST type to another could be handy. This would allow adding new AST types without more cppo madness.

mjambon avatar Dec 19 '19 18:12 mjambon