yason icon indicating copy to clipboard operation
yason copied to clipboard

There is no applicable method for the generic function on ClozureCL when *PRINT-PRETTY* is T

Open svetlyak40wt opened this issue 1 year ago • 3 comments

Here is a minimal example how to reproduce the problem:

(let ((*print-pretty* t))
  (yason:with-output-to-string* ()
    (yason:encode 0)))

Tested on CCL 1.12.1.

This code signals the error:

> Error: There is no applicable method for the generic function:
>          #<STANDARD-GENERIC-FUNCTION STREAM-LINE-COLUMN #x30200006F29F>
>        when called with arguments:
>          (#<YASON::JSON-OUTPUT-STREAM #x30200180229D>)

See also the similar issue: https://github.com/joaotavora/fiasco/issues/28 and it's fix: https://github.com/joaotavora/fiasco/commit/0cc08e798b10298e7a03254034305a77bf7eb063

svetlyak40wt avatar Oct 02 '24 14:10 svetlyak40wt

I've found there is a solution for CMUCL:

https://github.com/phmarek/yason/blob/master/encode.lisp#L500-L502

And if I enable it for CCL, like this:

#+(or cmucl ccl)
(defmethod trivial-gray-streams:stream-line-column ((stream json-output-stream))
  nil)

then the problem goes away!

svetlyak40wt avatar Oct 02 '24 14:10 svetlyak40wt

Would you be so kind as to provide a pull request, preferably with a test (unless there's already one)?

Thank you.

phmarek avatar Oct 08 '24 06:10 phmarek

Here is pull-request: https://github.com/phmarek/yason/pull/85

But it would be nice to rebuild the documentation there, because I've added a section on how to run tests for Yason.

Buy the way, if you would like. I can setup a github action to run tests on multiple CL implementations using my tool https://40ants.com/ci/

svetlyak40wt avatar Oct 08 '24 18:10 svetlyak40wt