19609 FileReference>>base should be before last separator

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

19609 FileReference>>base should be before last separator

alistairgrant
Hi All,

I've just taken a look at issue 19609 FileReference>>base should be
before last separator and wonder whether it is a correct interpretation
of the original intentions.

The original author of the issue, Michael, seems to feel that
FileReferene>>base and FileReference>>basenameWithoutExtension are the
same.

My reading of the comments is that they perform a different function,
i.e.:


'/a/b/c.d.e' asFileReference base.  "c"
'/a/b/c.d.e' asFileReference basenameWithoutExtension.  "c.d"


are both the expected values, i.e.:

- #base answers the name up to the first extensionDelimiter.
- #basenameWithoutExtension answers the name without what is typically
  considered the file extension (the bit after the last
  extensionDelimiter).

Not shown above, but:

- #basename answers the entire filename, i.e. "c.d.e".


Does anyone know the history of these methods?


Cheers,
Alistair

Reply | Threaded
Open this post in threaded view
|

Re: 19609 FileReference>>base should be before last separator

Stephane Ducasse-3
I do not know but I imagine that I added basenameWithoutExtension because
I found the name much much clearer. I would have never guessed that
base is the basename without the extension.

Stef

On Wed, Aug 16, 2017 at 9:46 PM, Alistair Grant <[hidden email]> wrote:

> Hi All,
>
> I've just taken a look at issue 19609 FileReference>>base should be
> before last separator and wonder whether it is a correct interpretation
> of the original intentions.
>
> The original author of the issue, Michael, seems to feel that
> FileReferene>>base and FileReference>>basenameWithoutExtension are the
> same.
>
> My reading of the comments is that they perform a different function,
> i.e.:
>
>
> '/a/b/c.d.e' asFileReference base.  "c"
> '/a/b/c.d.e' asFileReference basenameWithoutExtension.  "c.d"
>
>
> are both the expected values, i.e.:
>
> - #base answers the name up to the first extensionDelimiter.
> - #basenameWithoutExtension answers the name without what is typically
>   considered the file extension (the bit after the last
>   extensionDelimiter).
>
> Not shown above, but:
>
> - #basename answers the entire filename, i.e. "c.d.e".
>
>
> Does anyone know the history of these methods?
>
>
> Cheers,
> Alistair
>

Reply | Threaded
Open this post in threaded view
|

Re: 19609 FileReference>>base should be before last separator

alistairgrant
Hi Stef,

On Thu, Aug 17, 2017 at 05:08:40PM +0200, Stephane Ducasse wrote:
> I do not know but I imagine that I added basenameWithoutExtension because
> I found the name much much clearer. I would have never guessed that
> base is the basename without the extension.
>
> Stef

Thanks for the clarification.  Although #base isn't the name without the
extension, it is the portion of the name up to the first extension
delimiter (for names with a single extension delimiter the two will of
course be the same, but for names with multiple extension delimiters
they will be different).

In that case, assuming no one else comes up with additional
information, I would argue that the issue should be closed (rejected),
and Michael should change his code to use #basenameWithoutExtension
instead of #base.

It would be nice to improve the comments in the code - I'll add it to my
list. :-)


Cheers,
Alistair


> On Wed, Aug 16, 2017 at 9:46 PM, Alistair Grant <[hidden email]> wrote:
> > Hi All,
> >
> > I've just taken a look at issue 19609 FileReference>>base should be
> > before last separator and wonder whether it is a correct interpretation
> > of the original intentions.
> >
> > The original author of the issue, Michael, seems to feel that
> > FileReferene>>base and FileReference>>basenameWithoutExtension are the
> > same.
> >
> > My reading of the comments is that they perform a different function,
> > i.e.:
> >
> >
> > '/a/b/c.d.e' asFileReference base.  "c"
> > '/a/b/c.d.e' asFileReference basenameWithoutExtension.  "c.d"
> >
> >
> > are both the expected values, i.e.:
> >
> > - #base answers the name up to the first extensionDelimiter.
> > - #basenameWithoutExtension answers the name without what is typically
> >   considered the file extension (the bit after the last
> >   extensionDelimiter).
> >
> > Not shown above, but:
> >
> > - #basename answers the entire filename, i.e. "c.d.e".
> >
> >
> > Does anyone know the history of these methods?
> >
> >
> > Cheers,
> > Alistair
> >
>

Reply | Threaded
Open this post in threaded view
|

Re: 19609 FileReference>>base should be before last separator

Eliot Miranda-2
In reply to this post by Stephane Ducasse-3
Hi Stef,

On Thu, Aug 17, 2017 at 8:08 AM, Stephane Ducasse <[hidden email]> wrote:
I do not know but I imagine that I added basenameWithoutExtension because
I found the name much much clearer. I would have never guessed that
base is the basename without the extension.

While basenameWithoutExtension is an intension revealing selector it is soon loooonnnnngggg :-)  For file manipulation code that's a problem.   I wonder if something like bodyName is better because it's shorter.


Stef

On Wed, Aug 16, 2017 at 9:46 PM, Alistair Grant <[hidden email]> wrote:
> Hi All,
>
> I've just taken a look at issue 19609 FileReference>>base should be
> before last separator and wonder whether it is a correct interpretation
> of the original intentions.
>
> The original author of the issue, Michael, seems to feel that
> FileReferene>>base and FileReference>>basenameWithoutExtension are the
> same.
>
> My reading of the comments is that they perform a different function,
> i.e.:
>
>
> '/a/b/c.d.e' asFileReference base.  "c"
> '/a/b/c.d.e' asFileReference basenameWithoutExtension.  "c.d"
>
>
> are both the expected values, i.e.:
>
> - #base answers the name up to the first extensionDelimiter.
> - #basenameWithoutExtension answers the name without what is typically
>   considered the file extension (the bit after the last
>   extensionDelimiter).
>
> Not shown above, but:
>
> - #basename answers the entire filename, i.e. "c.d.e".
>
>
> Does anyone know the history of these methods?
>
>
> Cheers,
> Alistair
>




--
_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: 19609 FileReference>>base should be before last separator

Nicolas Cellier


2017-08-17 20:43 GMT+02:00 Eliot Miranda <[hidden email]>:
Hi Stef,

On Thu, Aug 17, 2017 at 8:08 AM, Stephane Ducasse <[hidden email]> wrote:
I do not know but I imagine that I added basenameWithoutExtension because
I found the name much much clearer. I would have never guessed that
base is the basename without the extension.

While basenameWithoutExtension is an intension revealing selector it is soon loooonnnnngggg :-)  For file manipulation code that's a problem.   I wonder if something like bodyName is better because it's shorter.


25 years ago I had `aFilename basename withoutExtension` in my vw app...
I don't think that such decomposition is a big efficiency problem for scripting.

Nicolas


Stef

On Wed, Aug 16, 2017 at 9:46 PM, Alistair Grant <[hidden email]> wrote:
> Hi All,
>
> I've just taken a look at issue 19609 FileReference>>base should be
> before last separator and wonder whether it is a correct interpretation
> of the original intentions.
>
> The original author of the issue, Michael, seems to feel that
> FileReferene>>base and FileReference>>basenameWithoutExtension are the
> same.
>
> My reading of the comments is that they perform a different function,
> i.e.:
>
>
> '/a/b/c.d.e' asFileReference base.  "c"
> '/a/b/c.d.e' asFileReference basenameWithoutExtension.  "c.d"
>
>
> are both the expected values, i.e.:
>
> - #base answers the name up to the first extensionDelimiter.
> - #basenameWithoutExtension answers the name without what is typically
>   considered the file extension (the bit after the last
>   extensionDelimiter).
>
> Not shown above, but:
>
> - #basename answers the entire filename, i.e. "c.d.e".
>
>
> Does anyone know the history of these methods?
>
>
> Cheers,
> Alistair
>




--
_,,,^..^,,,_
best, Eliot

Reply | Threaded
Open this post in threaded view
|

Re: 19609 FileReference>>base should be before last separator

Sean P. DeNigris
Administrator
In reply to this post by Eliot Miranda-2
Eliot Miranda-2 wrote
While basenameWithoutExtension is an intension revealing selector it is
soon loooonnnnngggg :-)  For file manipulation code that's a problem.   I
wonder if something like bodyName is better because it's shorter.
While I too feel a bit of pain from the long selector, I have reservations with #bodyName because I already know I will not remember what that means and will have to constantly look it up. IIRC we already have #base and #basename, which seem to be made up labels for subtle distinctions and I can never remember the difference. I think the domain here is nuanced enough to defy simple labels. I remember when we first integrated FS there was confusion/unworkability around "extension" vs. "extensions" for e.g. /myfile.tar.zip vs. /mypackage.1.mcz
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: 19609 FileReference>>base should be before last separator

Stephane Ducasse-3
In reply to this post by alistairgrant
Thanks Alistair.

On Thu, Aug 17, 2017 at 5:50 PM, Alistair Grant <[hidden email]> wrote:

> Hi Stef,
>
> On Thu, Aug 17, 2017 at 05:08:40PM +0200, Stephane Ducasse wrote:
>> I do not know but I imagine that I added basenameWithoutExtension because
>> I found the name much much clearer. I would have never guessed that
>> base is the basename without the extension.
>>
>> Stef
>
> Thanks for the clarification.  Although #base isn't the name without the
> extension, it is the portion of the name up to the first extension
> delimiter (for names with a single extension delimiter the two will of
> course be the same, but for names with multiple extension delimiters
> they will be different).
>
> In that case, assuming no one else comes up with additional
> information, I would argue that the issue should be closed (rejected),
> and Michael should change his code to use #basenameWithoutExtension
> instead of #base.
>
> It would be nice to improve the comments in the code - I'll add it to my
> list. :-)
>
>
> Cheers,
> Alistair
>
>
>> On Wed, Aug 16, 2017 at 9:46 PM, Alistair Grant <[hidden email]> wrote:
>> > Hi All,
>> >
>> > I've just taken a look at issue 19609 FileReference>>base should be
>> > before last separator and wonder whether it is a correct interpretation
>> > of the original intentions.
>> >
>> > The original author of the issue, Michael, seems to feel that
>> > FileReferene>>base and FileReference>>basenameWithoutExtension are the
>> > same.
>> >
>> > My reading of the comments is that they perform a different function,
>> > i.e.:
>> >
>> >
>> > '/a/b/c.d.e' asFileReference base.  "c"
>> > '/a/b/c.d.e' asFileReference basenameWithoutExtension.  "c.d"
>> >
>> >
>> > are both the expected values, i.e.:
>> >
>> > - #base answers the name up to the first extensionDelimiter.
>> > - #basenameWithoutExtension answers the name without what is typically
>> >   considered the file extension (the bit after the last
>> >   extensionDelimiter).
>> >
>> > Not shown above, but:
>> >
>> > - #basename answers the entire filename, i.e. "c.d.e".
>> >
>> >
>> > Does anyone know the history of these methods?
>> >
>> >
>> > Cheers,
>> > Alistair
>> >
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: 19609 FileReference>>base should be before last separator

Michel Bany
In reply to this post by alistairgrant
Hi Alistair,

First, I confirm that my code was changed to use #basenameWithoutExtension, this will avoid problems until this issue is completely solved.

For the rest I disagree, because the #base method does not make any sense, it has no semantics, it serves no purpose. I think that the #base method should be deprecated and that all the senders of #base should be revised so that they properly use #basenameWithoutExtension.

See for instance the syntax of file names for Microsoft https://msdn.microsoft.com/en-us/library/ms909516.aspx, or on Wikipedia https://en.wikipedia.org/wiki/Filename, there is no such "base" concept defined there.

Cheers,
Michel