finalisation

Julian Fitzell julian at beta4.com
Thu Jan 22 22:43:25 UTC 2004


Craig Latta wrote:
>>>>FileStream class>>fileNamed: fileName do: aBlock
>>>>     |file|
>>>>     file := self fileNamed: fileName.
>>>>     [aBlock value: file] ensure: file close
>>
>>Actually, it would be better with a ^ in front of the last line...
> 
> 
> 	It should also do the creation inside the ensured block. As it is, the
> process running the code could get stopped before the ensured block is
> evaluated, leaving the file dangling.

In that case, you'd presumably need to add an #ifNotNil: check before 
closing the file...

Julian




More information about the Squeak-dev mailing list