Skip to content

span doesn't work well with “local input streams” #75

@augfab

Description

@augfab

Hi,

I'm using :com.inuoe.jzon v1.1.4 on SBCL 2.2.9 on Ubuntu 24.04.2 on x86_64.

I don't know exactly what to call those “local input streams” created with constructs such as cl:with-input-from-string or flexi-streams:with-input-from-sequence; in any case, I was expecting the following to work, alas it doesn't:

CL-USER> (cl:with-input-from-string (input "{}") (com.inuoe.jzon:span input :end 2))
; Evaluation aborted on #<TYPE-ERROR expected-type:
;              (OR FILE-STREAM SYNONYM-STREAM BROADCAST-STREAM)
;              datum: #<SB-IMPL::STRING-INPUT-STREAM {10042F0C63}>>.
CL-USER> (flexi-streams:with-input-from-sequence (input #(91 93)) (com.inuoe.jzon:span input :end 2))
; Evaluation aborted on #<TYPE-ERROR expected-type:
;              (OR FILE-STREAM SYNONYM-STREAM BROADCAST-STREAM)
;              datum:
;              #<FLEXI-STREAMS::VECTOR-INPUT-STREAM {1004F53D63}>>.

The error seems to come from line 1083 of src/jzon.lisp (in definition of span):

        (unless (<= 0 start end (file-length in))

In SBCL file-length is very strict about the type of its argument.

Am I doing something wrong? (Relative newcomer to Common Lisp 😅)

Thanks for your work on this package 👍

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions