* Re: char-set-contains? and #<eof> [not found] ` <AANLkTilFKj35sp01j4VEVx_u_9NCqeXvxmxSVfKt8szE@mail.gmail.com> @ 2010-05-31 8:39 ` Andy Wingo 2010-05-31 16:27 ` Ludovic Courtès 2010-05-31 17:47 ` No Itisnt 0 siblings, 2 replies; 4+ messages in thread From: Andy Wingo @ 2010-05-31 8:39 UTC (permalink / raw) To: No Itisnt; +Cc: guile-devel Hi, [keeping the list cc'd] On Sun 30 May 2010 22:24, No Itisnt <theseaisinhere@gmail.com> 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? One point against such a change is that such programs would not be portable -- at least PLT Scheme^H^HRacket raises errors in these situations, as Guile does. But OTOH Racket folks are not themselves against changes where things make sense, so perhaps this is not a strong argument. Andy -- http://wingolog.org/ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: char-set-contains? and #<eof> 2010-05-31 8:39 ` char-set-contains? and #<eof> Andy Wingo @ 2010-05-31 16:27 ` Ludovic Courtès 2010-06-01 7:59 ` Andy Wingo 2010-05-31 17:47 ` No Itisnt 1 sibling, 1 reply; 4+ messages in thread From: Ludovic Courtès @ 2010-05-31 16:27 UTC (permalink / raw) To: guile-devel Hi, Andy Wingo <wingo@pobox.com> writes: > On Sun 30 May 2010 22:24, No Itisnt <theseaisinhere@gmail.com> 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’. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: char-set-contains? and #<eof> 2010-05-31 16:27 ` Ludovic Courtès @ 2010-06-01 7:59 ` Andy Wingo 0 siblings, 0 replies; 4+ messages in thread From: Andy Wingo @ 2010-06-01 7:59 UTC (permalink / raw) To: Ludovic Courtès; +Cc: guile-devel On Mon 31 May 2010 18:27, ludo@gnu.org (Ludovic Courtès) writes: > Andy Wingo <wingo@pobox.com> writes: > >> On Sun 30 May 2010 22:24, No Itisnt <theseaisinhere@gmail.com> writes: >> >>>>> 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? > > EOF and char are clearly disjoint types. No argument there :) The point is that the return type of read-char is not "Char"; it is either a char or EOF. The proposal is to make char predicates return #f for EOF as well, making them accept the same type as read-char returns. > I don’t see how R5RS or SRFI-14 would allow this It does seem to be permissible; not normal, but it could be useful. More useful than raising an error, I would imagine... Cheers, Andy -- http://wingolog.org/ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: char-set-contains? and #<eof> 2010-05-31 8:39 ` char-set-contains? and #<eof> Andy Wingo 2010-05-31 16:27 ` Ludovic Courtès @ 2010-05-31 17:47 ` No Itisnt 1 sibling, 0 replies; 4+ messages in thread From: No Itisnt @ 2010-05-31 17:47 UTC (permalink / raw) To: Andy Wingo; +Cc: guile-devel On Mon, May 31, 2010 at 3:39 AM, Andy Wingo <wingo@pobox.com> wrote: > Hi, > > [keeping the list cc'd] I apologize ; I keep doing that because I'm using this webmail interface. I really need to set up my email properly one of these days. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-06-01 7:59 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <AANLkTikpekY58j-WBWs-nimGYeZyRufmkuz-79R50b9I@mail.gmail.com> [not found] ` <AANLkTinJecu2RjnXHlOfbhUJl4B5SyGRqTzZPznd_DuS@mail.gmail.com> [not found] ` <m3hblps1ms.fsf@pobox.com> [not found] ` <AANLkTilFKj35sp01j4VEVx_u_9NCqeXvxmxSVfKt8szE@mail.gmail.com> 2010-05-31 8:39 ` char-set-contains? and #<eof> Andy Wingo 2010-05-31 16:27 ` Ludovic Courtès 2010-06-01 7:59 ` Andy Wingo 2010-05-31 17:47 ` No Itisnt
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).