On 1/8/2013 12:14 PM, Camillo Bruni wrote:
On 2013-01-08, at 18:01, Esteban Lorenzano <[email protected]> wrote:
anyway, even if there are easier ways to create references, I think Jimmie is
right, there are inconsistencies in the protocol.
maybe for 3.0?
yes definitely :).
Jimmie, maybe you can open an issue on code.google.com/p/pharo/?
with a complete list of the methods you find confusing?
I opened an issue on the basename usage at:
http://code.google.com/p/pharo/issues/detail?id=7222
I wasn't really confused by anything in particular that I mentioned.
Just noting what I saw as an inconsistency in a method name.
The documentation that Stef referred to should help.
I do like the 'MyPath' asFileReference method.
What I have found confusing is the workingDirectory which is an instance
variable.
In a workspace I did the following.
Initial workingDirectory
fr1 := FileSystem disk workingDirectory.
fr1. " file://C:\Users\Jimmie\Pharo\images"
fs1 := FileSystem disk.
fs1 workingDirectory." file://C:\Users\Jimmie\Pharo\images"
New FileSystem instance
fs2 := FileSystem disk.
workingDirectory is the same as the first instance.
fs2 workingDirectory." file://C:\Users\Jimmie\Pharo\images"
Change workingDirectory on the new instance using the instance method
#workingDirectoryPath:
fs2 workingDirectoryPath: Path / 'C:\Users\Jimmie'.
fs2 workingDirectory." file://C:\Users\Jimmie"
First instance workingDirectory unchanged.
fs1 workingDirectory." file://C:\Users\Jimmie\Pharo\images"
New FileSystem instance.
fs3 := FileSystem disk.
workingDirectory is the same as the changed one on the second instance.
fs3 workingDirectory." file://C:\Users\Jimmie"
fs1 workingDirectory." file://C:\Users\Jimmie\Pharo\images"
fs2 workingDirectory." file://C:\Users\Jimmie"
New FileSystemDirectoryEntry instance has the new workingDirectory
fr2 := FileSystem disk workingDirectory.
fr2." file://C:\Users\Jimmie"
What I don't understand is why using an instance method to change an
instance variable, changes something in the class which affects the
initial state of new instances.
This was an unexpected behavior for me as I was operating on an instance
variable via an instance method. At least so I thought.
I may have overlooked such, but I haven't seen any documentation about
this behavior. So I don't know if this is the desired behavior or if it
is a bug.
I was hoping for the workingDirectory to be an instance variable which
could be different for each instance. It would be nice if a FileSystem
object could be created with the desired workingDirectory.
But I imagine that the proper way to do such is to rather create a
FileReference to the desired directory and operate on it.
Just curious.
Jimmie