Subject: [clisp-list] READ-SEQUENCE-NO-HANG / READ-SOME-SEQUENCE

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Thu Nov 14 08:29:02 2002

Hi,

here's something from comp.lang.lisp IMHO relevant to a recent discussion on clisp-list:

From: Duane Rettig <[email-masked]>
Subject: Re: Checking for EOF
Newsgroups: comp.lang.lisp
Date: Mon, 11 Nov 2002 22:00:01 GMT

[...]
If you use simple-streams, bivalence comes for free, and you don't have
to worry about whether you are testing for characters or octets; the
same functionality tends to be used for both.  Although if there is a
chance that your stream which has a multibyte external-format might
have half-a-character before the eof, then instead of testing for
characters, you might want to test for octet availability;
simple-streams offers a read-no-hang-p function to check _any_
avaiability of data on the stream, including just one octet, whereas
listen, stream-listen, and read-char-no-hang all try to build a
character, and might end up either giving you a false end-of-file
indication half-a-character early, or else never giving you an eof
(each being consequenses of not being able to complete that last
character).

The CLISP-related discussion was about [tiny parts of it]:
>Sam Steingold wrote:
>>  In addition to READ-SEQUENCE-ONCE, you
>>will need also READ-CHAR-SEQUENCE-ONCE and READ-BYTE-SEQUENCE-ONCE
>>(and make them generic functions too - see gray.lisp)
> We already have READ-CHAR-NO-HANG and READ-BYTE-NO-HANG, so, I think,
> READ-SEQUENCE-NO-HANG is the right name, if we really need it.
Jörg Höhle wrote:
>I fear this is going into nightmares -- consider the 
>multi-byte character / partial read interaction (e.g. that 
>other current thread about Chinese): what if you read only 
>half of a 2byte character?

My long-time feeling is that CLISP's streams is not the best one can get. A native simple-streams *may* solve many problems CLISP currently faces. That means another rewrite of that huge stream.d file. :-(

Regards,
	Jörg Höhle.