Walter Bright wrote:
Daniel Keep wrote:
Because if it stripped it, there's no way to know what it was.  If you
want to do per-line processing but don't want to clobber the line
endings, readln has to return the line terminator.

Who wants to receive a line with varying line endings anyway???

That's right; there are currently at least 6 different line terminators:

CR
LF
CRLF
FF
PS
LS

So the programmer who wants to write portable code, has to implement awareness for all of these cases, in each of his programs?

This seems a bit laborious. Replacing stuff at the end of the string forces him to check, for *each* line, the length of the terminator, and then use ...$-1 and at other times ...$-2, etc. in his code.

In 25 years of computing, I have yet to see a file where variation of line termintators in the file contained some /deliberate/ information. And the only purpose for keeping the line endings would be to edit files while preserving the particular line terminator for each line. Which raises the question, how do you decide which terminator to use if you've inserted a line?

So the whole point is absurd. A reasonable default behavior for a file mongering program would be to output line terminators according to the operating system default. The case where one *wants* to preserve them, should be considered the exception.


I'm simply asking for the default to be to strip the terminator, thus relieving the programmer from, imho, gratuituos labor. You can still preserve the current functionality as an option.

Reply via email to