[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bugs in guile-json builder

From: John Cowan
Subject: Bugs in guile-json builder
Date: Wed, 2 Jan 2019 10:14:16 -0500

I'm not sure where best to report these, so sending this email.

JSON numbers have to be, in Scheme terms, either exact integers or inexact
reals excluding +inf.0, -inf.0, and +nan.0.  Guile-json will blithely
output any of these three as well as 1/2, 3.4+5.6i, etc., which will not
work with other JSON parsers.

Symbols are currently output as JSON strings.  This will be problematic if
anyone depends on it and you decide to switch to the symbol null for JSON
null, as I suggested in my previous email.  I think symbols should be
invalid as JSON values.

Symbols and numbers are allowed as object keys, converting them to strings,
which is reasonable but should be documented.

If you pass anything but a string, a symbol, or a number as an object key,
you get a low-level error from string->list instead of a proper
json-invalid error.

The builder doesn't validate the native object first.  This requires an
extra tree walk, but for example if you call (json-scm (vector 1 2 3 #u8(1
2 3))) it will output "[1,2,3" before throwing an exception.  This is not
the Right Thing: a procedure that does output should work correctly or fail
cleanly without outputting anything.

John Cowan        address@hidden
People go through the bother of Christmas because Christmas helps them
to understand why they go through the bother of living out their lives
the rest of the year. For one brief instant, we see human society as it
should and could be, a world in which business has become the exchanging
of presents and in which nothing is important except the happiness and
well-being of the ultimate consumer.  --Northrop Frye (1948)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]