Menu

#26 Bugfix: load: Don't set inport

tinyscheme-1.43
open
nobody
None
3
2020-09-28
2020-06-16
No
R5RS specifically says that `load` does not affect the values returned
`current-input-port` and `current-output-port`.

https://schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-9.html#%_sec_6.6.4

This bug is causing tinyscheme to fail every one of these benchmarks:
https://github.com/ecraven/r7rs-benchmarks/blob/master/results.TinyScheme

Before:

% echo 1234 | ./scheme -c '(begin (display (read)) (newline))'
==> #<EOF>
% echo 1234 | ./scheme <( echo '(begin (display (read)) (newline))' )
==> #<EOF>

After:

% echo 1234 | ./scheme <( echo '(begin (display (read)) (newline))' )
==> 1234
% echo 1234 | ./scheme -c '(begin (display (read)) (newline))'
==> 1234
1 Attachments

Discussion

  • Rodion Gorkovenko

    This seems to be severe! It prevents ./scheme reading from console when program is run from file. Would be good to merge the suggested patch unless it breaks anything :)

    E.g. if we create the file test.scm:

    (display "Enter something:")
    (display (read))
    (newline)
    

    and try running it with ./scheme test.scm, it won't stop to wait for user input, instead printing literally Enter something:(newline).

     
  • Kevin Cozens

    Kevin Cozens - 2020-09-28
    • Group: --> tinyscheme-1.43
     

Log in to post a comment.