Hi!
It is now the Issue #124 on google code.
I also propose some refactoring under the name SLICE-
FixingUglyCodeRelatedtoFiles
In PharoInBox
Cheers,
Alexandre
On 30 Jul 2008, at 12:09, Alexandre Bergel wrote:
While browsing at referencer of FileDoesNotExistException, I
discovered the following pattern that is used in many different
places. I find this pretty ugly:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
file := [fd readOnlyFileNamed: keysFileName]
on: FileDoesNotExistException do:[:ex| nil].
file ifNil:[^self]. "no keys file"
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The use of exception is completely outwitted.
I would rather write:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[file := fd readOnlyFileNamed: keysFileName]
on: FileDoesNotExistException do: [:ex| ^ self].
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
If some of you agree, I will add an issue and fix where this occurs
(e.g., CompiledMethod>>timeStamp, FileDirectory
class>>retrieveMIMEDocument:, FileUrl>>retrieveContents,
ResourceManager class>>loadResource: urlString, fromCacheFileNamed:
fileName in: dir, ResourceManager class>>lookupCachedResource:
cachedUrlString ifPresentDo: streamBlock,
SecurityManager>>loadSecurityKeys)
Cheers,
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project