Good day to everyone.
The bundle attached herewith contains patches to upgrade CL-JSON to
the new version 0.4.0 which incorporates changes we have been
discussing of late. The changes are rather wide-scale (the sheer
size of the patches is 415k), almost every aspect of the
implementation differs from what we had in version 0.3.1 and
earlier. The most important points are:
1. The decoder now has the customization mechanism from decoder-
vars.lisp, with imperative handlers and aggregate-scope variables.
2. The encoder provides a streaming API (borrowed from YASON). The
standard encode methods are re-implemented using that API.
3. The CLOS decoder has undergone serious modifications to address
the issue of degrading performance in some Lisp implementations. It
shall be possible to use anonymous “fluid” objects created by the
decoder in a way which makes for a “poor man's JavaScript”. The
CLOS encoder does not emit prototype metadata anymore (unless
specifically requested).
4. I have written a new pair of matching functions to convert
between camel case and Lisp names.
5. There is an improved exception signalling mechanism. Some things
which previously were handled by callbacks now use conditions /
restarts.
6. JSON-BIND now uses the event-based decoder API with dynamic
customization. This has the advantage that the user may choose the
semantics with which to decode interior values. However, I had to
forego the support for Lisp trees as arguments to JSON-BIND.
7. Some exported names were changed:
Condition JSON-PARSE-ERROR → JSON-SYNTAX-ERROR
Macro WITH-LIST-DECODER-SEMANTICS → WITH-DECODER-SIMPLE-
LIST-SEMANTICS
Macro WITH-CLOS-DECODER-SEMANTICS → WITH-DECODER-SIMPLE-
CLOS-SEMANTICS
I have made sure the tests pass in Clozure CL, SBCL, CMUCL, CLisp,
and ECL.
There is a new User's Manual in doc/cl-json.html (I have also
uploaded a copy to http://dpworks.net/smilga/cl-json.html). And here
I would like to humbly ask someone on this mailing list who is a
native speaker of English to proof-read it. Russian, my natural
idiom, is quite unlike English in grammar, conventional style, and
punctuation. Though I am more or less fluent in the latter, I never
fully trust myself, especially with the choice of articles,
“which” / “that”, and modal and causative constructions.
Also, if you think some passages confused or inarticulate, by all
means do not hesitate to point me to them. Thank you in advance.
Sincerely,
- B. Smilga.
Trying the latest patches on todays cvs version of sbcl, 1.0.27.9,
totally breaks the testcases. Whereas the old version works. So be a
bit careful to use the darcs version for a while in a stable
environment.
Otherwise, It seems there are lots of cool new features, and the
documentation is great. I've put it online here:
http://common-lisp.net/project/cl-json/cl-json.html
Boris, one thing I am not sure about, the security implications of the
clos decoder. How do you make sure that an evil user doesn't create a
lispClass ticking-bomb in the lispPackage not-so-secret? Or do I read
the docs to bad?
Regards,
Henrik