[squeak-dev] support of various line ends in trunk

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Mon Nov 16 20:20:50 UTC 2009


1] ABOUT RECENT CHANGES IN TRUNK:

st-80 line end policy was really simple (always CR).
It was the best choice possible as long as staying in Smalltalk world.
However, I was kind of fed-up with all the hacks for converting
to/from various line end flavours, half of which not working...

- Since communicating with external world is vital for my own view of Squeak
- Since It is far more simple to handle the zoo of line delimiters in Kernel
  (CompositionScanner / DispalyScanner / String / Stream)
I just added this support in trunk.

Now, we should be able to import any line termination transparently in
the image.
For exporting, nothing changed, we still have to care, no magic here,
this is driven by external applications requirements.

To profit by the new possibilities, just use:
- (String>>linesDo:) rather than searching indexOf: Character cr
- (Stream>>nextLine) rather than upTo: Character cr

There might be some LF/CR-LF support lacking here and there (there are
so many #cr senders...), but that shouldn't be hard to fix.

2] IMPORTANT NOTE AND QUESTION:

SocketStream>>nextLine does insist on finding a CR-LF pair.
This is used in some major protocols.
But I find this abusive, and would like to change the default behavior
to that of Stream.
This would be a nice property that a SocketStream behaves like a
FileStream or an ExternalStream.
Should I proceed ?

Nicolas



More information about the Squeak-dev mailing list