Smalltalk: Requiem or Resurgence? Push for business application

Yoshiki Ohshima yoshiki at
Thu May 25 18:18:23 UTC 2006


> >   (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' ]

  You're right.  I must have thinking about on:do:.

> > 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).

  I don't know.  That is why I said hypothetical.

-- Yoshiki

More information about the Squeak-dev mailing list