bugMIT/GNU Scheme - Bugs: bug #62623, Unable to write bytes in REPL


bug #62623: Unable to write bytes in REPL

Submitter:  None
Submitted:  Tue 14 Jun 2022 03:59:54 AM UTC
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Originator Email:  -email is unavailable- Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Mon 05 Sep 2022 08:38:20 AM UTC, comment #1: 

It's not possible for a port to be both textual and binary using the current design.

The simplest solution for your case would be to do

(write-char (integer->char <byte>))

However, the default coding for the console port (and most other textual ports) is utf-8, so you should first do

(port/set-coding (current-output-port) 'us-ascii)

so that characters are correctly converted back to bytes.

Chris Hanson <cph>
Group administrator
Tue 14 Jun 2022 03:59:54 AM UTC, original submission:  

Evaluating (write-u8 65) at the REPL will produce this error:

;The object #[textual-i/o-port 12 for console], passed as an argument to #[compiled-procedure 13 ("binary-port" #x3) #x1c #x23a9984], is not the correct type.

This is because the REPL's output port is not a binary port:

(binary-port? (current-output-port))   ; returns #f
(textual-port? (current-output-port))  ; returns #t

Would it be possible to make the REPL's output port both a textual port and a binary port, so that bytes can be written at the REPL?



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by cph (Posted a comment)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code