Ricardo Moran uploaded a new version of Files to project Etoys:
http://source.squeak.org/etoys/Files-Richo.2.mcz==================== Summary ====================
Name: Files-Richo.2
Author: Richo
Time: 14 October 2011, 7:45:37 pm
UUID: 4b4a91a3-f143-ed49-862b-b7b624a1241b
Ancestors: Files-bf.1
Added two useful methods to FileStream class: #fileNamed:do: and #forceNewFileNamed:do: (taken from Squeak)
=============== Diff against Files-bf.1 ===============
Item was added:
+ ----- Method: FileStream class>>fileNamed:do: (in category 'instance creation') -----
+ fileNamed: fileName do: aBlock
+ "Avi Bryant says, ''This idiom is quite common in other languages that make heavy use of closures (i.e. Lisp (with-file 'foo' (f) ...) and Ruby (File.open('foo'){|f|...})). It's time Squeak had it, too.''
+
+ Returns the result of aBlock."
+
+ ^self detectFile: (self fileNamed: fileName) do: aBlock!
Item was added:
+ ----- Method: FileStream class>>forceNewFileNamed:do: (in category 'instance creation') -----
+ forceNewFileNamed: fileName do: aBlock
+ "Avi Bryant says, ''This idiom is quite common in other languages that make heavy use of closures (i.e. Lisp (with-file 'foo' (f) ...) and Ruby (File.open('foo'){|f|...})). It's time Squeak had it, too.''
+
+ Returns the result of aBlock."
+
+ ^self detectFile: (self forceNewFileNamed: fileName) do: aBlock!
_______________________________________________
etoys-dev mailing list
[hidden email]
http://lists.squeakland.org/mailman/listinfo/etoys-dev