| I was looking at the ensure: usage in the image. And I found this one (besides the third line :) and I was wondering if it would not make sense to check them all (ensure:, forceNewFileNamed:.....) because if forceNewFileNamed: returns nil the ensure will not work. writeEncoded: bytes | file | fileName ifNil:[^self]. false ifTrue:[^self]. file := FileStream forceNewFileNamed: fileName. [file nextPutAll: bytes] ensure:[file close]. I was also looking at readOnlyFileNamed: and it does not return nil readOnlyFileNamed: fileName "Open an existing file with the given name for reading." | fullName f | fullName := self fullName: fileName. f := self new open: fullName forWrite: false. ^ f isNil ifFalse: [f] ifTrue: ["File does not exist..." ((FileDoesNotExistException fileName: fullName) readOnly: true) signal]. "StandardFileStream readOnlyFileNamed: 'kjsd.txt' " I found some inconsistencies: For example BMPReadWriter>>nextPutImage: aForm as a stream close as the last messages while all the other methods do not and should be protected by an ensure: may be we could have a task for going over the implementation of fileStream and also the ensure: uses. Stef |
_______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
