Smalltalk: Requiem or Resurgence? Push for business application

Chris Muller chris at
Thu May 25 18:00:44 UTC 2006

Hi Yoshiki and Ron,

Ron wrote: 

> > make sense to always use UTF-8.  In any case the goal is to have
> one method
> > that reads and writes available on String and on Collection which
> works for
> > all platforms.

This goal is already achieved in base Squeak with something called
ReferenceStream.  In fact, its much more robust in that it can handle
any graph of objects, not just a Collection of Strings.

Legacy files with lists of Strings are certainly application-specific. 
I can't see Collection as an appropriate place for parsing, say,
comma-delimited files.  I would use a CsvParser or something..

Yoshiki wrote:

>   (I guess you just wanted to illustrate the idea, but just a
> sidenote...  Using #ensure: just to close the file is quite
> debatable,
> especially if it covers just a part of method.  In the above code,
> the
> file open error is notified to the user (or calling method). 
> However,
> if the writing fails for some reason such as disk-full, it siliently
> closes the file and pretends the requested operation was successful.

I take you up on this debate because, with all due respect, I think
this is wrong.  An error while writing the file would not be silent and
pretend success at all.  Demonstrated:

  [ self error: 'disk full' ] ensure: [ Transcript cr; show: 'now
ensure is executed' ]

> And, think about an hypothetical case where opening file succeeds but
> the assignment to the 'fileStream' variable fails...)

How could this possibly happen?  And, even IF that happened then the
state of the system is so tenuous and uncertain that ensure: is not
going to do any harm (or help, probably).


More information about the Squeak-dev mailing list