[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: char-set-contains? and #<eof>
From: |
Ludovic Courtès |
Subject: |
Re: char-set-contains? and #<eof> |
Date: |
Mon, 31 May 2010 18:27:21 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Hi,
Andy Wingo <address@hidden> writes:
> On Sun 30 May 2010 22:24, No Itisnt <address@hidden> writes:
>
>>> For example, what would you have Guile do here:
>>>
>>> (even? #f) => ?
>>> (char-whitespace? 42) => ?
>>
>> I'd have it raise an error.
>>
>>>> The reason it bothers me is because it makes it cumbersome to deal
>>>> with input from a port.
>>>
>>> True; but it's just how it is, I think. The EOF object is not a
>>> character.
>>
>> But it is returned by read-char, unlike the other examples.
>
> A fair point. The consistent thing to do would be to make all char-foo?
> predicates return #f for the EOF object (char<? and friends excluded of
> course). Ludovic what do you think?
I don’t see how R5RS or SRFI-14 would allow this. For instance R5RS has
this:
-- procedure: char? obj
Returns #t if OBJ is a character, otherwise returns #f.
and this:
-- procedure: eof-object? obj
Returns #t if OBJ is an end of file object, otherwise returns #f.
The precise set of end of file objects will vary among
implementations, but in any case no end of file object will ever
be an object that can be read in using `read'.
So EOF and char are clearly disjoint types.
Am I missing something?
Thanks,
Ludo’.