[R6RS] I/O questions

Michael Sperber sperber at informatik.uni-tuebingen.de
Sun May 28 06:46:56 EDT 2006


[Side note: I intend to revise SRFI 79 and 81 in the light of what
we've discussed as soon as the wedding's over.]

Generally, SRFI 79 contains a condition hierarchy that I'd like to
propose for I/O.  As with the rest, it's possibly too detailed: It
might be enough to have &i/o-error,
&i/o-operation-not-available-error, and &i/o-filename-error.

#49 and #50 are the items from Will's list that apply in spirit, but
need detail fixes to match SRFIs 79/81.  They've already been voted
on, so I don't see the need to bring them up again:

49.  If any I/O procedure detects what would (in most other
    languages/libraries) be considered an I/O error, then it
    (must/should/may/might/returns/abstain/discuss)

    Vote: must, must, must, must, must

    Outcome: must

    raise an exception with
    condition type: &i/o-error

50.  If `open-file-reader' or `open-file-input-port' is asked
    to open a file that doesn't seem to exist, then it
    (must/should/may/might/returns/abstain/discuss)

    Vote: must, must, must, must, must

    Outcome: must

    raise an exception with
    condition type: &i/o-no-such-file-error

This issue doesn't apply directly, because SRFI 79 specifies file
options which influence how the I/O procedures behave:

51. If `open-file-writer' or `open-file-output-port' is asked
    to open a file that seems already to exist, and the file-options
    set contains the `create' but not the `exclusive' option then it
    (must/should/may/might/returns/abstain/discuss)

    Vote: 

    raise an exception with
    condition type: &i/o-file-already-exists-error

Here's a new issue:

52'.If a filename argument to a I/O procedure expecting a filename is not
    a string, but some other object that designates a filename on the
    executing system, then the procedure
    (must/should/may/might/returns/abstain/discuss)

    Vote: 

    raise an exception with
    condition types: &i/o-malformed-filename-error, &domain

With that in mind, it makes sense to restrict #52 in the following
way:

52. If the filename argument to any of the procedures expecting a
    filename is a string that does not have the form
    that is used to name files on the executing
    systems, then it
    (must/should/may/might/returns/abstain/discuss)

    Vote: 

    raise an exception with
    condition types: &i/o-malformed-filename-error, &domain

#61 goes like this in the context of SRFI 81:

61. If the first argument to `write-char', `write-string', or
    `write-string-n' cannot be output to its second argument (e.g. the
    seconds argument to `write-char' is some weird Unicode character, and
    the output port accepts only ASCII characters), then it
    (must/should/may/might/returns/abstain/discuss/
     writes an encoded ? character/writes some other character)

    Vote: 

    raise an exception with
    condition type: &incompatible

It has an obvious sister:

62.'If `read-char', `read-string', or `read-string-n' encounters an
    invalid encoding in the data stream, then it
    (must/should/may/might/returns/abstain/discuss/
     reads a ? character and skips a byte/does something else)
 
    Vote: 

    raise an exception with
    condition type: &i/o-encoding-error

Here are new issues (all related to the degree of specifiedness, but
not all related to exceptions; I hope that's OK):

I/O#1. If an use of the `file-options' macro has, as an operand, a
       symbol other than `create', `exclusive', or `truncate', then it
       (must/should/may/might/returns/abstain/discuss)

       Vote:

       raise an exception with
       condition type: &syntax

       Note: 

I/O#2. The reader returned by `open-file-reader' 
       (must/should/may/might/must not/abstain/discuss)

       Vote:

       have `get-position', `set-position!', and `end-position'
       operations.

I/O#3. The reader returned by `open-file-writer 
       (must/should/may/might/must not/abstain/discuss)

       Vote:

       have `get-position', `set-position!', and `end-position'
       operations.

I/O#4. The reader returned by `standard-input-reader 
       (must/should/may/might/must not/abstain/discuss)

       Vote:

       have `get-position', `set-position!', and `end-position'
       operations.

I/O#5. The reader returned by `standard-output-reader 
       (must/should/may/might/must not/abstain/discuss)

       Vote:

       have `get-position', `set-position!', and `end-position'
       operations.

I/O#6. The reader returned by `standard-error-reader 
       (must/should/may/might/must not/abstain/discuss)

       Vote:

       have `get-position', `set-position!', and `end-position'
       operations.


I/O#7. If `transcode-input-port!' is called on a port that is already
       transcoded, then it

       (must/should/may/might/abstain/discuss)

       raise an exception with
       condition type: &i/o-transcoded

I/O#8. If `transcode-output-port!' is called on a port that is already
       transcoded, then it

       (must/should/may/might/abstain/discuss)

       raise an exception with
       condition type: &i/o-transcoded


-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla



More information about the R6RS mailing list