Alexandre Bergel wrote:
At the first glance readOnlyFileNamed:ifNone: seems to be a useful primitive. But this having the file absent might be just one case. You could have ifNotReadable:, ifParentFolderNotReadable:. Also, an error when writing in a file may occur in many different situation (disk full, file read only, ...). You may also want to provide handler for each of these situation (e.g., writeFileNamed: aName with: stream ifDiskFull: [...] ifAlreadyExistingFile: [...]...

Agree...

I agree you are improving on the existing code, but I would prefer
something like

 file := fd readOnlyFileNamed:name ifNone:[ ^self ].

a solution would be to pass in any Exception into the ifNone: block:

file := fd readOnlyFileNamed:name ifNone:[:ex| ^self ].

Then depending on whether you are actually interested in the exact reason the file couldn't be created you could look at the exception.

Michael

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to