[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A few random I/O proposals

On Tue, 26 May 92 20:02:38 PDT, kend@data.rain.com (Ken Dickey) said:

>> * It is impossible to open a file while allowing for the possibility
>> that it might not be openable.  The section on open-input-file says
>> that "If the file cannot be opened, an error is signalled"; this may
>> be okay for some circumstances, but there are times when you want
>> something better than this.  Two solutions that have been proposed are
>> to have some other value be returned in this circumstance, #f being
>> the obvious choice; or to allow the user some way to signal errors.

> Note that I also proposed (FILE-EXISTS? <whatever-filespec-rnrs-accepts>)
> so that in the trivial case the problem could be avoided.

Yeah, I thought of that, but there are so many cases in which
FILE-EXISTS? doesn't get the behaviour that you want that they are
really two quite separate issues.

> I believe that the handler proposal, if accepted, could be worded to
> support the facility you desire.


>> * There should be some sort of way to get the printed representation
>> of an arbitrary object in string form, and to read the printed
>> representation of an arbitrary object from a string. 

> The problem with this is that (1) you typically want the abstract
> object {i.e. recreate a record or instance rather than letrec'ed
> lambdas} and (2) you need to be able to print nested and circular
> structures.  One can certainly do this locally and as part of the
> programming environment, but I can't see adding this to the language.
> Environmental features are by definition not part of rnrs.

I think I didn't express myself clearly, or maybe I don't understand
what you're saying.  (Or probably both.)  What I want is to be able to
do the equivalent of read, write, and display from/to strings.  So,
for example, if string ports were added, then that would give me the
facilities that I wanted.  I don't care about being able to, say,
convert something to a string, convert it back, and get an object that
is eq? to the same object, and I don't care about reading/writing
circular structures; or rather, while facilities like that can be
important and useful, they're not what I was proposing, and are
basically orthogonal to it.

david carlton