Thread overview
[Issue 14845] [REG 2.068] some rangified Char[] functions no longer take a static array
Jul 31, 2015
Walter Bright
Jul 31, 2015
Kenji Hara
Jul 31, 2015
Walter Bright
Aug 01, 2015
Martin Nowak
Aug 01, 2015
Walter Bright
Aug 03, 2015
Martin Nowak
Aug 03, 2015
Martin Nowak
Aug 03, 2015
Martin Nowak
July 31, 2015
https://issues.dlang.org/show_bug.cgi?id=14845

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> ---
(In reply to Martin Nowak from comment #0)
> The only fully compatible overload is (T, size_t n)(ref T[n] s), which
> should forward to the rangified function.

The trouble with such overloads is they produce a new instance for every different array size. This can result in an unnoticed blizzard of bloat.

I think this should be marked as "wontfix".

--
July 31, 2015
https://issues.dlang.org/show_bug.cgi?id=14845

--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> ---
And as my humble opinion, I feel a "rangified funciton" accepts *only* ranges. By definition, static array is not range. So when I use that, I think the explicit slice for the static array is necessary in order to get its range view.

--
July 31, 2015
https://issues.dlang.org/show_bug.cgi?id=14845

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--
August 01, 2015
https://issues.dlang.org/show_bug.cgi?id=14845

Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |---

--- Comment #3 from Martin Nowak <code@dawg.eu> ---
(In reply to Walter Bright from comment #1)
> The trouble with such overloads is they produce a new instance for every different array size. This can result in an unnoticed blizzard of bloat.

Well than you mark that function as always inline.
It only slices that static array and forwards that.

> I think this should be marked as "wontfix".

Didn't we have a strong commitment to no longer break code? We should add those overloads, but can deprecate them IMO.

(In reply to Kenji Hara from comment #2)

> And as my humble opinion, I feel a "rangified funciton" accepts *only* ranges.

Exactly rangified, those functions didn't took a ranges before and now they *only* take ranges.

--
August 01, 2015
https://issues.dlang.org/show_bug.cgi?id=14845

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> ---
(In reply to Martin Nowak from comment #3)
> Well than you mark that function as always inline.

Code is still generated for it.

> Didn't we have a strong commitment to no longer break code?

We do have a strong commitment to that. It is not an absolute commitment, nor is it a commitment we should follow without using judgment.

It is an undue burden to add all these overloads everywhere, and those overloads encourage and hide a bad practice.

--
August 03, 2015
https://issues.dlang.org/show_bug.cgi?id=14845

--- Comment #5 from Martin Nowak <code@dawg.eu> ---
(In reply to Walter Bright from comment #4)
> It is an undue burden to add all these overloads everywhere, and those overloads encourage and hide a bad practice.

That's why I suggested to deprecate them.

--
August 03, 2015
https://issues.dlang.org/show_bug.cgi?id=14845

--- Comment #6 from Martin Nowak <code@dawg.eu> ---
(In reply to Walter Bright from comment #4)
> It is an undue burden to add all these overloads everywhere, and those overloads encourage and hide a bad practice.

What burden, it's a bunch of one-liners?

Ignoring this in the first place already broke vibe.d b/c of indexOf.
Who knows what code gets used by the rest of the function and every tiny
breaking change fragments the supported dmd versions of dub packages, making it
unnecessarily hard for people.

The only way we can improve on compiler/language stability is to take it serious.

--
August 03, 2015
https://issues.dlang.org/show_bug.cgi?id=14845

--- Comment #7 from Martin Nowak <code@dawg.eu> ---
Mmh, even the static array overload doesn't work.

For whatever reason/bug the ref to a static array gets matched when being called with a string literal.

/// Ditto
deprecated("Please slice the static array before calling chomp.")
auto chomp(C1, size_t n)(ref C1[n] str)
    if (isSomeChar!C1)
{
    C1[] slice = str[];
    return chomp(slice);
}

--