Re: Read-line bug in STk 4.0.1 - missing control-Ms.

From: Harvey J. Stein <hjstein_at_bfr.co.il>
Date: 31 Dec 1999 12:24:02 -0500

Erick Gallesio <Erick.Gallesio_at_unice.fr> writes:

> Harvey, has explained, better than me, why the file configuration
> function could is not the panacea. Anyway you an he have convinced me
> that I have probably not made the better choice here for read-line.
>
> Harveys says:
> > So, I guess I'd be most in favor of an option to read-line to say what
> > EOL should be, with the default being the same as the hosting
> > platform, and with strict conversion being done.
>
> I'm OK, but what do you mean by "strict conversion"?

I have no idea what I meant! At this point I'd strike everything
from the last comma up to but not including the period. I was writing
this by grabbing a minute here & there over the course of several
days. I must have been lax in my editing.

But, now that I'm thinking about it some more, I'd suggest more than
just eol demarcation as a read-line option. I'd suggest allowing a
list of strings and whether or not eol should be stripped from the
output string. That would seem to allow for all possibilities,
including making read-line invertible (by using the option not to
strip eol). So, maybe something like:

   (read-line port &optional strip-eol eol-strings)

where strip-eol is #t or #f & defaults to #t & eol-strings is a list
of strings to recognize as end of line markers which defaults to the
eol string for the native platform.

An approximation of the current behavior (somewhat improved, IMHO, by
not deleting arbitrary ^M characters) would be gotten by:

   (read-line port #t '("\n" "\r\n"))

> > Setting port options is a close second, although it looks like a
> > lot of work...
>
> Yes, but it could appear by part. I will have a look at it.

I'm not sure now either why I said it was a close second. I guess I'd
still call it a close second. Not because it's a worse API, but
because it seems to require sizable changes & has lots of subtle
border cases. Although I do have trouble imagining why someone would
want low level end of line conversion & would be using a read function
other than read-line. Except that after writing that I realized it
could be relevant for reading code from the net or cross platform.
One could want to do (read ...) with conversion so as to get strings
containing line breaks properly converted. For example, code such as:

   (define (usage)
       (format #t "foo arg1 arg2 arg3 ...
This function does blah blah blah.\n"))`

-- 
Harvey Stein
Bloomberg LP
hjstein_at_bfr.co.il
Received on Fri Dec 31 1999 - 18:24:49 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST