Re: make-binary-input-port calling convention

Felix Winkelmann via Chicken-users <[email protected]> Tue, 19 May 2026 11:06:43 +0200
Newsgroups gmane.lisp.scheme.chicken
Message-ID <[email protected]>
On Tue May 19, 2026 at 2:04 AM CEST, Peter McGoron via Chicken-users wrote:
> The manual page[1] for make-binary-input-port says that=20
> `read-bytevector` will be called with 4 arguments, but it gets called=20
> with 3.
>
> [1]:=20
> https://wiki.call-cc.org/man/6/Module%20(chicken%20port)#make-binary-inpu=
t-port
>
> (import (scheme base) (chicken port))
>
> (let ((custom (make-binary-input-port
>                 (lambda () 0)
>                 (lambda () #t)
>                 (lambda () #t)
>                 #:read-bytevector
>                 (lambda (port num bv offset)
>                   (display "foobar\n")
>                   (do ((i 0 (+ i 1)))
>                       ((=3D i num) num)
>                     (bytevector-u8-set! bv (+ offset i) 0))))))
>    (read-bytevector 10 custom))
>
> Raises an argument mismatch error.

Yes, documentation was incorrect: the read-bytevector procedure takes
a bytevector and start + end positions.


cheers,
felix