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

Re: [Scheme-reports] (read|write)-char [was Opinion about R7RS]



John Cowan <cowan@x> wrote:

> Jean-Michel HUFFLEN scripsit:
>
> (...)
>
>> Now, if we open an output port with the Latin-1 encoding, some valid
>> characters of Unicode cannot be written: what happens in such a case?
>
> It's implementation-dependent.

    I understand your point of view, but here is the problem I point out.

    In Scheme, a well-known of implementation-dependent feature is the  
order for evaluating the arguments of a function. You may write dirty  
code such that:

(- (read) (read))

that may result in what you expect on a particular interpreter. But  
obviously this code is not portable. On another point, we can write  
portable code, even if we do not know the order for evaluating  
arguments. That is why I think that this feature is not bad; for me,  
portability is very important, I developed a large application which  
runs on several Scheme interpreters/compilers.

    If we consider now (open-input-file ...) R5RS did not provide a  
standard function to check if the input file exists, and we were  
unable to catch the error signalled. The only solution was a kind of  
plug-and-socket mechanism to use nonstandard functions like  
"file-exists?" provided by most of Scheme interpreters. This  
implementation-dependent feature was bad from my point of view, since  
we have to search particular implementations for nonstandard functions.

    Let us go back to characters. You do not want to give any  
priviledge to a particular encoding. OK. How can I write portable  
code, running on several interpreters? Some characters may be not  
included in the encoding used for writing characters. How can I make  
sure that I will avoid errors? For me, if I had:
    - a function returning the default encoding used,
    - a function returning the available encodings,
I would be the happiest programmer. Encodings and error management  
would be implementation-dependent, but we would have a way to get  
information about what a particular implementation can provide. You  
mentioned that Java and C# do not provide such functions. I would be  
unhappy if I have to program my applications in Java or C#.

    Cheers,

J.-M. Hufflen


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports