From: Freja Nordsiek <fnordsie@gmail.com>
To: 24816@debbugs.gnu.org
Subject: bug#24816: Bug in (rnrs io ports) procedure open-string-output-port
Date: Sat, 29 Oct 2016 17:29:09 +0700 [thread overview]
Message-ID: <CAOqf98rpbCCv7TVOOYtzPmnK0xDo71fyuei0EXmkTGpCTBN4oA@mail.gmail.com> (raw)
The "open-string-output-port" procedure in (rnrs io ports) returns two
values, a string port and a thunk that returns a string of the
characters written to the port so far. In the R6RS standard documents,
the reading procedure is destructive, in that it clears all the
characters written to the port so far (though, it does not close it,
so it can still be used). However, in Guile 2.1.4, the characters are
not cleared and so running the thunk again immediately afterwards will
produce the same output, which is a bug.
This can be tested running the following script
(import (rnrs base (6))
(rnrs io ports (6))
(rnrs io simple (6)))
(let-values (((p get-output) (open-string-output-port)))
(display "hello" p)
(flush-output-port p)
(let ((out-first (get-output)))
(let ((out-second (get-output)))
(display (string-append "Follows R6RS: "
(if (string=? out-first out-second)
"no"
"yes")))
(newline)
(display (string-append "out-first: " out-first))
(newline)
(display (string-append "out-second: " out-second))
(newline))))
which produces the following output in guile
Follows R6RS: no
out-first: hello
out-second: hello
when it should output
Follows R6RS: yes
out-first: hello
out-second:
instead.
Freja Nordsiek
next reply other threads:[~2016-10-29 10:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-29 10:29 Freja Nordsiek [this message]
2017-03-01 13:26 ` bug#24816: Bug in (rnrs io ports) procedure open-string-output-port Andy Wingo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOqf98rpbCCv7TVOOYtzPmnK0xDo71fyuei0EXmkTGpCTBN4oA@mail.gmail.com \
--to=fnordsie@gmail.com \
--cc=24816@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).