[squeak-dev] What is the contract of SocketStream>>#next:?

Chris Muller asqueaker at gmail.com
Tue Oct 7 21:40:01 UTC 2014


On Tue, Oct 7, 2014 at 3:42 PM, Nicolas Cellier
<nicolas.cellier.aka.nice at gmail.com> wrote:
> Since (String new readStream next: 4) answers an empty string, so at least
> this seem consistent with the rest...
> Some dialects have something like nextAvailable: 4 for this behavior and let
> next: 4 raise an exception, but not Squeak.

I get your point about consistency but isn't that impossible /
unusable for SocketStream?  Because there would be no way to discern
the difference between a Timeout and EOD (end of data).

I feel I should be able to write:

  header := mySocketStream next: 4

and not have to check the length of header before I access it.

Otherwise, please tell me what I should have to do if I get only 3
bytes of data back when I need and expect 4?  Treat it the same as a
Timeout?  Or loop try again?  Aren't those what SocketStream should be
doing for me?


More information about the Squeak-dev mailing list