[Glass] GsFile atEnd answering nil rather than boolean

Dale Henrichs via Glass glass at lists.gemtalksystems.com
Wed Mar 4 11:12:02 PST 2015


On 03/04/2015 05:13 AM, Mariano Martinez Peck via Glass wrote:
> What is funny is that there is a class called BinaryOrTextFile which I 
> have no clue what it is (no class comment and doesn't appear in guides 
> either), but it's a subclass of GsFile and implements:
>
> atEnd
>
> | ans |
> (ans := super atEnd) == nil ifTrue: [ ^true ].
> ^ans
>
>
> So...it is assuming that GsFile atEnd answering nil is like true.... 
> while superclass (GsFile) #atEnd method comment  says the primitive 
> answers nil upon error.
>

I think that BinaryOrTextFile was implemented to fill the missing gap 
for FileStream and dates from the very early days of GLASS (8 years ago?).

Historically GemStone has returned nil instead of raising errors for 
GsFile and friends which has made writing porting code from Squeak/Pharo 
somewhat dicey, since you have to look at each Smalltalk call and test 
for nil ....


FileStream is a more recent addition and is obviously missing test 
coverage ... help in this area would be appreciated ... I have never 
said no to code improvement contributions:) I just haven't gotten that 
many over the years:(

Dale


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20150304/ff901b04/attachment.html>


More information about the Glass mailing list