oldFileNamed

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

oldFileNamed

Henrik Sperre Johansen
Forgetting the wish for new File accessing implementations for a moment, is there a reason why the current StandardFileStream >> oldFileNamed: (and oldFileFullyNamed) is implemented:

^(self isAFileNamed: fileName)
ifTrue: [self new open: fileName forWrite: true]
ifFalse: [(FileDoesNotExistException fileName: fileName) signal]

instead of :

^(self new open: fullName forWrite: true) ifNil:
["File does not exist..."
(FileDoesNotExistException fileName: fullName) signal] ?

Feels abit silly to open a file to see if it exists, then close it, then open it again before returning it... (It also causes an unneccessary rehash of StandardFileStream registry on success)

Cheers,
Henry



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: oldFileNamed

Damien Cassou
2009/7/3 Henrik Johansen <[hidden email]>:

> Forgetting the wish for new File accessing implementations for a moment, is
> there a reason why the current StandardFileStream >> oldFileNamed: (and
> oldFileFullyNamed) is implemented:
> ^(self isAFileNamed: fileName)
> ifTrue: [self new open: fileName forWrite: true]
> ifFalse: [(FileDoesNotExistException fileName: fileName) signal]
> instead of :
> ^(self new open: fullName forWrite: true) ifNil:
> ["File does not exist..."
> (FileDoesNotExistException fileName: fullName) signal] ?
> Feels abit silly to open a file to see if it exists, then close it, then
> open it again before returning it... (It also causes an unneccessary rehash
> of StandardFileStream registry on success)

Please submit an issue in the tracker and provides a changeset or a
mcz with your change. I will have a look at it.

Thank you for your report

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: oldFileNamed

Henrik Sperre Johansen
http://code.google.com/p/pharo/issues/detail?id=921

On Jul 3, 2009, at 2:39 00PM, Damien Cassou wrote:

> 2009/7/3 Henrik Johansen <[hidden email]>:
>> Forgetting the wish for new File accessing implementations for a  
>> moment, is
>> there a reason why the current StandardFileStream >> oldFileNamed:  
>> (and
>> oldFileFullyNamed) is implemented:
>> ^(self isAFileNamed: fileName)
>> ifTrue: [self new open: fileName forWrite: true]
>> ifFalse: [(FileDoesNotExistException fileName: fileName) signal]
>> instead of :
>> ^(self new open: fullName forWrite: true) ifNil:
>> ["File does not exist..."
>> (FileDoesNotExistException fileName: fullName) signal] ?
>> Feels abit silly to open a file to see if it exists, then close it,  
>> then
>> open it again before returning it... (It also causes an  
>> unneccessary rehash
>> of StandardFileStream registry on success)
>
> Please submit an issue in the tracker and provides a changeset or a
> mcz with your change. I will have a look at it.
>
> Thank you for your report
>
> --
> Damien Cassou
> http://damiencassou.seasidehosting.st
>
> "Lambdas are relegated to relative obscurity until Java makes them
> popular by not having them." James Iry
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>


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