Sockets and finalisation
Avi Bryant
avi at beta4.com
Thu Jan 22 22:18:35 UTC 2004
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.
Avi
More information about the Squeak-dev
mailing list
|