[cl-json-devel] cl-json depends on lisp reader?
Robert Goldman
rpgoldman at sift.info
Sun Nov 4 19:59:59 UTC 2012
On 10/31/12 Oct 31 -5:26 PM, Boris Smilga wrote:
> On Wed, Oct 31, 2012 at 5:07 PM, Sven Emtell <sven.emtell at doremir.com>
> wrote:
>>
>> I use cl-json with LispWorks 6.1.
>> When delivering an app, I am trying to minimize the size of it by
>> setting delivery level 5.
>> The cl-json function "decode-json-from-string" does not seem to like
>> this without explicitly keeping the Lisp Reader using the delivery
>> keyword (:keep-lisp-reader).
>> Since the Lisp Reader is unnecessary for the rest of the app, I would
>> like to leave it out when delivering.
>> Any thoughts on this?
>
> The Lisp reader is used on just one occasion, namely, in the function
> PARSE-NUMBER in src/decoder.lisp (line 417ff., four uses of
> READ-FROM-STRING). You can easily ditch it by supplying another parser
> for numbers. For this end, you have three options: A) wait for someone
> to develop a replacement—without guarantees; B) write a replacement
> yourself, send a patch to the maintainers, and wait for it to be pushed
> to the repository; C) customize DECODE-JSON in your own code, by setting
> or binding the handlers for number token. If you choose option C, I'd
> suggest you read the relevant chapter in the User Guide
> (http://common-lisp.net/project/cl-json/#DECODER-CUSTOMIZATION). The
> handlers in question are represented by the variables *INTEGER-HANDLER*
> and *REAL-HANDLER*.
Wouldn't it be possible to replace all uses of READ-FROM-STRING here
with PARSE-INTEGER?
We would have to change the structure here from "try READ-FROM-STRING
and if that fails, parse by hand" to just "parse by hand," but I think
that would be reasonable.
If so, I suggest we simply do that....
I have a patch, but it could use some review and check on multiple lisp
implementations. I'll try to get it out today.
Best,
Robert
More information about the cl-json-devel
mailing list