printString of fileReference sucks!

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

printString of fileReference sucks!

Stephane Ducasse-3
Hi

'/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
asFileReference printString
>>>  "File @ /Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result"

so either we add @ one File or we redefine printString one reference to be

'/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
asFileReference so that we can do something with the printString
result.

What do you think?
Guille is it what we talked together?

Setf

Reply | Threaded
Open this post in threaded view
|

Re: printString of fileReference sucks!

Esteban A. Maringolo
Hi Stef, all,

I've seen this "inconsistency" as well. The current printSting tries
to be descriptive but isn't handy to work with.

I would go one step further and have no #asFileReference suffix nor
File @ prefix, it is:

'/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
asFileReference printString
>>> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'


If for some reason the option chosen is to keep the current
printString then the printString should be:
>>> 'File @ ''/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'''

It is, a string with three tokens, the class name, the @ symbol and a
string as an argument, that way you can evaluate the result back.

I prefer the first one, it enables you to work with files on
workspaces, if you're using inspectors the printString doesn't matter
much, since you're dealing with a specialized tool and there is no way
you can confuse a FileReference with a regular String instance

Best regards,
Esteban A. Maringolo


2018-02-02 16:12 GMT-03:00 Stephane Ducasse <[hidden email]>:

> Hi
>
> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
> asFileReference printString
>>>>  "File @ /Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result"
>
> so either we add @ one File or we redefine printString one reference to be
>
> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
> asFileReference so that we can do something with the printString
> result.
>
> What do you think?
> Guille is it what we talked together?
>
> Setf
>

Reply | Threaded
Open this post in threaded view
|

Re: printString of fileReference sucks!

Stephane Ducasse-3
Exactly, let us see what others think and we fix it.

To me FileSystem deserves some love.


On Fri, Feb 2, 2018 at 8:39 PM, Esteban A. Maringolo
<[hidden email]> wrote:

> Hi Stef, all,
>
> I've seen this "inconsistency" as well. The current printSting tries
> to be descriptive but isn't handy to work with.
>
> I would go one step further and have no #asFileReference suffix nor
> File @ prefix, it is:
>
> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
> asFileReference printString
>>>> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
>
>
> If for some reason the option chosen is to keep the current
> printString then the printString should be:
>>>> 'File @ ''/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'''
>
> It is, a string with three tokens, the class name, the @ symbol and a
> string as an argument, that way you can evaluate the result back.
>
> I prefer the first one, it enables you to work with files on
> workspaces, if you're using inspectors the printString doesn't matter
> much, since you're dealing with a specialized tool and there is no way
> you can confuse a FileReference with a regular String instance
>
> Best regards,
> Esteban A. Maringolo
>
>
> 2018-02-02 16:12 GMT-03:00 Stephane Ducasse <[hidden email]>:
>> Hi
>>
>> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
>> asFileReference printString
>>>>>  "File @ /Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result"
>>
>> so either we add @ one File or we redefine printString one reference to be
>>
>> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
>> asFileReference so that we can do something with the printString
>> result.
>>
>> What do you think?
>> Guille is it what we talked together?
>>
>> Setf
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: printString of fileReference sucks!

Stephane Ducasse-3
I saw that guillermo already needed it for pillar

Path >> pillarPrintString
  self isEmpty ifTrue: [ ^ '' ].
    ^ String streamContents: [ :str |
            str nextPutAll: (self at: 1) asString.
                    2 to: self size do: [:i |
                       str
                 nextPutAll: self delimiter;
                nextPutAll: (self at: i) ] ]


so there is clearly something wrong.



On Fri, Feb 2, 2018 at 8:57 PM, Stephane Ducasse
<[hidden email]> wrote:

> Exactly, let us see what others think and we fix it.
>
> To me FileSystem deserves some love.
>
>
> On Fri, Feb 2, 2018 at 8:39 PM, Esteban A. Maringolo
> <[hidden email]> wrote:
>> Hi Stef, all,
>>
>> I've seen this "inconsistency" as well. The current printSting tries
>> to be descriptive but isn't handy to work with.
>>
>> I would go one step further and have no #asFileReference suffix nor
>> File @ prefix, it is:
>>
>> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
>> asFileReference printString
>>>>> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
>>
>>
>> If for some reason the option chosen is to keep the current
>> printString then the printString should be:
>>>>> 'File @ ''/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'''
>>
>> It is, a string with three tokens, the class name, the @ symbol and a
>> string as an argument, that way you can evaluate the result back.
>>
>> I prefer the first one, it enables you to work with files on
>> workspaces, if you're using inspectors the printString doesn't matter
>> much, since you're dealing with a specialized tool and there is no way
>> you can confuse a FileReference with a regular String instance
>>
>> Best regards,
>> Esteban A. Maringolo
>>
>>
>> 2018-02-02 16:12 GMT-03:00 Stephane Ducasse <[hidden email]>:
>>> Hi
>>>
>>> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
>>> asFileReference printString
>>>>>>  "File @ /Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result"
>>>
>>> so either we add @ one File or we redefine printString one reference to be
>>>
>>> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
>>> asFileReference so that we can do something with the printString
>>> result.
>>>
>>> What do you think?
>>> Guille is it what we talked together?
>>>
>>> Setf
>>>
>>

Reply | Threaded
Open this post in threaded view
|

Re: printString of fileReference sucks!

Denis Kudriashov
In reply to this post by Esteban A. Maringolo
Hi.

I do not think that getting simple string as result is a good idea.
It is important to easily distinguish class of object using printIt operation and as a field in raw inspector.

During code migration to FileSystem it is classic way to check variables in debugger to see if they are already file references or they are still strings. printIt is very handy in such cases.

Best regards,
Denis

2018-02-02 20:39 GMT+01:00 Esteban A. Maringolo <[hidden email]>:
Hi Stef, all,

I've seen this "inconsistency" as well. The current printSting tries
to be descriptive but isn't handy to work with.

I would go one step further and have no #asFileReference suffix nor
File @ prefix, it is:

'/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
asFileReference printString
>>> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'


If for some reason the option chosen is to keep the current
printString then the printString should be:
>>> 'File @ ''/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'''

It is, a string with three tokens, the class name, the @ symbol and a
string as an argument, that way you can evaluate the result back.

I prefer the first one, it enables you to work with files on
workspaces, if you're using inspectors the printString doesn't matter
much, since you're dealing with a specialized tool and there is no way
you can confuse a FileReference with a regular String instance

Best regards,
Esteban A. Maringolo


2018-02-02 16:12 GMT-03:00 Stephane Ducasse <[hidden email]>:
> Hi
>
> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
> asFileReference printString
>>>>  "File @ /Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result"
>
> so either we add @ one File or we redefine printString one reference to be
>
> '/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'
> asFileReference so that we can do something with the printString
> result.
>
> What do you think?
> Guille is it what we talked together?
>
> Setf
>


Reply | Threaded
Open this post in threaded view
|

Re: printString of fileReference sucks!

Denis Kudriashov
In reply to this post by Esteban A. Maringolo
2018-02-02 20:39 GMT+01:00 Esteban A. Maringolo <[hidden email]>:
 
If for some reason the option chosen is to keep the current
printString then the printString should be:
>>> 'File @ ''/Users/ducasse/Workspace/FirstCircle/MyBooks/Bk-Writing/PharoBooks/Booklet-AMiniSchemeInPharo/_result'''

So I am for this approach
Reply | Threaded
Open this post in threaded view
|

Re: printString of fileReference sucks!

Sean P. DeNigris
Administrator
In reply to this post by Stephane Ducasse-3
Stephane Ducasse-3 wrote
> What do you think?

If it helps, here is some background material…

- The original issue where we (I) created this behavior, along with the
rationale:
https://pharo.fogbugz.com/f/cases/7366/FileReferences-have-a-confusing-wrong-external-representation
- A subsequent ML thread where we discussed this fairly extensively:
http://forum.world.st/Why-aFileReference-asString-aFileReference-fullName-is-false-tp4810690.html

FTR I am not attached to the current solution and defer to the majority…



-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html

Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: printString of fileReference sucks!

Stephane Ducasse-3
Tx I will reread the threads!

On Sat, Feb 3, 2018 at 4:07 AM, Sean P. DeNigris <[hidden email]> wrote:

> Stephane Ducasse-3 wrote
>> What do you think?
>
> If it helps, here is some background material…
>
> - The original issue where we (I) created this behavior, along with the
> rationale:
> https://pharo.fogbugz.com/f/cases/7366/FileReferences-have-a-confusing-wrong-external-representation
> - A subsequent ML thread where we discussed this fairly extensively:
> http://forum.world.st/Why-aFileReference-asString-aFileReference-fullName-is-false-tp4810690.html
>
> FTR I am not attached to the current solution and defer to the majority…
>
>
>
> -----
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
>