Open jackfirth opened 5 years ago
The main use case for EJS is JSON Schema. Indeed, the only reason EJS exists is to support equality checking of JSON numbers. Here's an issue with Argo that motivated the development of EJS.
If Racket's built-in JSON support supported arbitrary precision numbers (so that, say, (string->jsexpr "1.0")
were not equal to (string->jsexpr "1.000000000000000000000000000000000001")
, EJS could be abandoned. I thought about simply doing this change, but I backed away from doing it when I considered potential performance impacts.
I'm confused about the precise nature of the relationship between
ejs
and JSON. Specifically, the package description forejs
says this:And the README says this:
However, RFC 8259 cannot represent rational numbers like
1/3
that do not have a finite base-10 fractional part. This is checked for in theejsexpr->string
function:This is reasonable, but it seems at odds with this part of the README:
So I'm confused about what
ejs
is intending to represent. Is the set of EJS numbers supposed to be "RFC 8259 numbers", where1/3
is disallowed and0.2
is read as1/5
? Or is it supposed to be "exact rationals", thus EJS expressions are a strict superset of JSON where(and/c ejsexpr? number?)
does not implyejsexpr->string
will succeed? Either choice seems valid to me, but I thinkejs
should be clearer about which stance it's taking.