PositionableStream>>isEmpty

Bob Arning arning at charm.net
Thu Apr 6 00:23:43 UTC 2000


On Wed, 05 Apr 2000 16:17:24 -0700 Andres Valloud <avalloud at entrypoint.com> wrote:
>This method is:
>
>isEmpty
>    "Answer whether the receiver's contents has no elements."
>
>    ^position = 0
>
>??????????... shouldn't it be ^readLimit = 0???...

Here is Dan's answer from July 1998:

In my opinion, this is one of many places in Squeak that needs to get cleaned up rather than fixed.  #isEmpty is a message normally defined for collections (to go with size, at: , etc) and, at least now, streams are different from collections (built around atEnd, next, etc).

It isn't clear from the message name what is should mean for a stream since, for writing, it would probably mean 'has not been written into', or 'atBeginning', whereas for reading it would probably be 'usedUp', or 'atEnd'.  We could try "fixing" it as you suggest (the best fix would be a good comment) but I would first ask, where is this being used, and use stream protocol instead (probably involving a rename to #atBeginning). 

The question of where #isEmpty is sent to streams, of course, is a very difficult question to answer right now, since there are MANY senders of #isEmpty, of which probably only a couple (or hopefully none) are streams.

Yet another reason to get type inference working in Squeak.





More information about the Squeak-dev mailing list