Sockets and finalisation

Julian Fitzell julian at beta4.com
Thu Jan 22 22:29:21 UTC 2004


Avi Bryant wrote:
> 
> On Jan 22, 2004, at 2:13 PM, Brent Vukmer wrote:
> 
>>> FileStream class>>fileNamed: fileName do: aBlock
>>>     |file|
>>>     file := self fileNamed: fileName.
>>>     [aBlock value: file] ensure: file close
> 
> 
>> Couldn't resist submitting this, Avi.  Coolness.
> 
> 
> Actually, it would be better with a ^ in front of the last line, so that 
> you could do things like
> 
> contents := FileStream fileNamed: 'foo' do: [:f | f contentsOfEntireFile].
> 
> Also useful would be #readOnlyFileNamed:do:, #newFileNamed:do:, etc.

And that combinatorial explosion is probably why the methods don't 
exist... :)  Still, I agree they're useful.

Julian




More information about the Squeak-dev mailing list