Closed ghost closed 8 years ago
You have discovered an ambiguity in the R7RS specification of read-line
. There are three things that count as an end of line:
According to item 2, implementations of the R7RS are supposed to behave as follows:
> (define p (open-input-string "abc\r\r\rdef\n"))
> (read-line p)
"abc"
> (read-line p)
""
> (read-line p)
""
> (read-line p)
"def"
According to item 3, however, an implementation of R7RS might choose instead to behave as
> (define p (open-input-string "abc\r\r\rdef\n"))
> (read-line p)
"abc"
> (read-line p)
"def"
Larceny v0.98 doesn't behave in either of those ways, so Larceny v0.98 is incorrect.
Larceny will indeed be changed to implement one of the behaviors allowed by the R7RS. I haven't yet decided which behavior Larceny will implement.
Fixed by changeset 6f0ce4455c48bb2b346cd750203146714f2c0ec9
This is a simple test (using Larceny v0.98):
Run
larceny -r7rs -program test.ss
, it prints:If change
(display "abc\r\ndef" out)
to(display "abc\rdef" out)
, it prints:The R7RS says:
Will Larceny follow this definition?