Login  Register

Re: Need your point of view on FSPath * and others

Posted by Max Leske on Feb 19, 2011; 9:06am
URL: https://forum.world.st/Need-your-point-of-view-on-FSPath-and-others-tp3313975p3313992.html

Concerning question 4:
If I remember correctly, the problem is that a path is absolute if "path at: 1" answers ''. "FSPath with: '/parent/child'" creates a path with size 1 and not size three as you would expect in this case. So in my oppinion, the message #with: does not behave like one would expect. I have had troubles with this myself. I would suggest to change the behaviour of #with:.

Cheers,
Max



On 18.02.2011, at 23:40, Stéphane Ducasse wrote:

> Colin
>
> I'm continuing adding comments to FS.
> 1- A question about
>
> FSPath class>>* aString
>
> ^ self with: aString
>
> I would like to deprecated FSPath class>>* and use with: since this is the message
> and
>
> What do you think?
> I really prefer for static analysis point of view not to pollute numerical behavior with others.
> Avoiding ad-hoc polymorphism will help us to build static checker in the future.
>
>
> 2- Then I was wondering if it would not be good to have validating creation methods
>
> (FSPath * 'parent/child/') isRelative
> true
> (FSPath * '/parent/child/') isAbsolute
> false
> because the string is not checked
> FSPath * '/parejhkjhhg %% ^%$%^(%$546547675 nt??child/'
>
> I saw that there is
> readFrom: aStream delimiter: aCharacter
>
> so I created an unchecking instance creation category and I added with: and * in it.
> And added  comments
>
> 3- Then finally the following confuses me
>
> (FSPath with: 'parent/child/') isRelative true
> (FSPath with: '/parent/child/') isRelative true
> (FSPath with: '') isRelative false
>
> Either with: create relative path or isRelative is not consistent.
> If with: creates relative path then the last one should be true
> or isRelative should return false on the second one. ?
>
> 4 - about FSPath root
> we have
>
> root
> "Return the relative root path"
> ^ self with: ''
>
> FSPath root
> returns /
> and I like that
>
> Now what about defining root as
>
> root
> ^ self with: '/'
>
> It would be more consistent. Now it breaks everything. So I did not do it :)
>
>
>
> May be I'm tired after 4 ours teaching and 6 hours train.
>
>
>
> Thanks for your time
>
> Stef