October 29, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarch_dodra | On Tuesday, 29 October 2013 at 20:56:02 UTC, monarch_dodra wrote:
> On Tuesday, 29 October 2013 at 10:08:00 UTC, Sergei Nosov wrote:
>> I guess it's a good thing, it's available online. While looking through it, I also noticed that there are new functions 'stripLeft/stripRight'. I believe it would be more consistent to call those stripFront/stripBack.
>
> Yes, it would be, but they are also a generalization of the
> eponymous string functions. Naming the new functions
> "stripFront/stripBack" instead of "stripLeft/stripRight" would
> itself be the more inconsistent.
>
> For example:
> //std.string.stripLeft
> assert(stripLeft(" \tHello") == "Hello");
> //std.algorithm.stripLeft(R, E)(R r, E e);
> assert(stripLeft(" \tHello", ' ') == "\tHello");
> //std.algorithm.stripLeft(alias pred, R)(R r);
> assert(stripLeft!(Not!isLower)(" \tHello", ' ') == "ello");
>
> But you make a valid point.
How do these string functions handle RTL languages? Even for strings, 'front' and 'back' might be more appropriate than 'left' and 'right'.
|
October 29, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nicolas Sicard | On Tuesday, 29 October 2013 at 21:14:39 UTC, Nicolas Sicard wrote:
> How do these string functions handle RTL languages? Even for strings, 'front' and 'back' might be more appropriate than 'left' and 'right'.
Hum...
Now that you mention it, that is also a good point. I feel they should indeed be called stripFront and stripBack.
@jmdavis, @andrejmitrovic: how would you feel about such a change?
|
October 29, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarch_dodra | On 10/29/13, monarch_dodra <monarchdodra@gmail.com> wrote: > Now that you mention it, that is also a good point. I feel they should indeed be called stripFront and stripBack. > > @jmdavis, @andrejmitrovic: how would you feel about such a change? It's funny that you should tag us two, I've asked about this here: https://github.com/D-Programming-Language/phobos/pull/1201#issuecomment-17594047 Only got one reply, from JMD: https://github.com/D-Programming-Language/phobos/pull/1201#issuecomment-17984774 And it wasn't talked about since. I think using the alias approach would work, IOW std.array could use stripLeft/stripRight aliases to stripFront/stripBack which would be in std.algorithm. There's certainly nothing "left/right" about ranges. Should we fix this before the release is made? What do Andrei and others think? |
October 29, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | On 10/29/13 3:06 PM, Andrej Mitrovic wrote:
> On 10/29/13, monarch_dodra <monarchdodra@gmail.com> wrote:
>> Now that you mention it, that is also a good point. I feel they
>> should indeed be called stripFront and stripBack.
>>
>> @jmdavis, @andrejmitrovic: how would you feel about such a change?
>
> It's funny that you should tag us two, I've asked about this here:
>
> https://github.com/D-Programming-Language/phobos/pull/1201#issuecomment-17594047
>
> Only got one reply, from JMD:
>
> https://github.com/D-Programming-Language/phobos/pull/1201#issuecomment-17984774
>
> And it wasn't talked about since. I think using the alias approach
> would work, IOW std.array could use stripLeft/stripRight aliases to
> stripFront/stripBack which would be in std.algorithm. There's
> certainly nothing "left/right" about ranges.
>
> Should we fix this before the release is made? What do Andrei and others think?
I'm okay with either choice, just not both. There's precedent in other languages for stripLeft and stripRight, but stripFront/Back are closer to D's terminology. I have a very mild preference for the latter.
Thanks,
Andrei
|
October 30, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Tuesday, 29 October 2013 at 23:39:13 UTC, Andrei Alexandrescu wrote:
> I'm okay with either choice, just not both. There's precedent in other languages for stripLeft and stripRight, but stripFront/Back are closer to D's terminology. I have a very mild preference for the latter.
Funny you should say that, because my first reflex was to google search "stripLeft" to see if there was a precedent for it, and found nothing outside of dlang.
Who else uses "stripLeft" in their standard library?
I vote to change the names to stripFront/stripBack, and make deprecated aliases of stripLeft/stripRight in std.string.
|
October 30, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to monarch_dodra | On 10/30/13 2:14 AM, monarch_dodra wrote:
> On Tuesday, 29 October 2013 at 23:39:13 UTC, Andrei Alexandrescu wrote:
>> I'm okay with either choice, just not both. There's precedent in other
>> languages for stripLeft and stripRight, but stripFront/Back are closer
>> to D's terminology. I have a very mild preference for the latter.
>
> Funny you should say that, because my first reflex was to google search
> "stripLeft" to see if there was a precedent for it, and found nothing
> outside of dlang.
>
> Who else uses "stripLeft" in their standard library?
>
> I vote to change the names to stripFront/stripBack, and make deprecated
> aliases of stripLeft/stripRight in std.string.
I could have sworn googling for them would return a bunch of languages and libraries. I could only find on Haskell library. But then I could only find one library using stringFront/Back.
Since we've already had stripLeft/Back for strings, I vote to stop this changing names nonsense. Either pair is good, and we've voted for one already.
Andrei
|
October 30, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Wed, 30 Oct 2013 07:56:04 -0700, Andrei Alexandrescu wrote: > On 10/30/13 2:14 AM, monarch_dodra wrote: >> On Tuesday, 29 October 2013 at 23:39:13 UTC, Andrei Alexandrescu wrote: >>> I'm okay with either choice, just not both. There's precedent in other languages for stripLeft and stripRight, but stripFront/Back are closer to D's terminology. I have a very mild preference for the latter. >> >> Funny you should say that, because my first reflex was to google search "stripLeft" to see if there was a precedent for it, and found nothing outside of dlang. >> >> Who else uses "stripLeft" in their standard library? >> >> I vote to change the names to stripFront/stripBack, and make deprecated aliases of stripLeft/stripRight in std.string. > > I could have sworn googling for them would return a bunch of languages and libraries. I could only find on Haskell library. But then I could only find one library using stringFront/Back. > > Since we've already had stripLeft/Back for strings, I vote to stop this changing names nonsense. Either pair is good, and we've voted for one already. > > > Andrei Left & Right or L & R are apparently used in VB6 like languages, TCL, Python, Delphi & TSQL https://en.wikipedia.org/wiki/Trimming_(computer_programming) Phil |
October 31, 2013 Re: DMD 2.064 changelog typo? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Wednesday, October 30, 2013 07:56:04 Andrei Alexandrescu wrote:
> On 10/30/13 2:14 AM, monarch_dodra wrote:
> > On Tuesday, 29 October 2013 at 23:39:13 UTC, Andrei Alexandrescu wrote:
> >> I'm okay with either choice, just not both. There's precedent in other languages for stripLeft and stripRight, but stripFront/Back are closer to D's terminology. I have a very mild preference for the latter.
> >
> > Funny you should say that, because my first reflex was to google search "stripLeft" to see if there was a precedent for it, and found nothing outside of dlang.
> >
> > Who else uses "stripLeft" in their standard library?
> >
> > I vote to change the names to stripFront/stripBack, and make deprecated aliases of stripLeft/stripRight in std.string.
>
> I could have sworn googling for them would return a bunch of languages and libraries. I could only find on Haskell library. But then I could only find one library using stringFront/Back.
>
> Since we've already had stripLeft/Back for strings, I vote to stop this changing names nonsense. Either pair is good, and we've voted for one already.
They were originally stripl and stripr, so googling may find those more easily. But that didn't follow our naming conventions, so we changed it when we tried to make std.string consistent with our naming scheme. And stripLeft and stripRight are what stripl and stripr stood for, so that's how they got those names.
stripFront and stripBack would arguably be better names for ranges in general, but given that we already have stripLeft and stripRight, I agree that we should just leave it as-is rather than having to deal with renaming std.string.stripLeft and std.string.stripRight yet again. stripLeft and stripRight might not be quite as nice names for range-based stuff, but they work. We can argue names all day, and I don't think that there's enough gain in this case to be worth the change. If the original names had followed our naming conventions properly, they likely never would have been renamed in the first place. That's the primary reason that we've renamed stuff, and that's not the case here.
- Jonathan M Davis
|
Copyright © 1999-2021 by the D Language Foundation