Thread overview
[Issue 23523] Allow User-Defined Implicit Conversions for const/immutable containers
Nov 30, 2022
John Hall
Dec 04, 2022
Nick Treleaven
Dec 17, 2022
Iain Buclaw
November 30, 2022
https://issues.dlang.org/show_bug.cgi?id=23523

--- Comment #1 from John Hall <john.michael.hall@gmail.com> ---
In the past the argument from Walter against something like opImplicitCast has always been that users would get confused about random things happening if they had freedom to do any implicit cast they could think of.

The solution to this would be only to allow the implicit conversions discussed above. So instead of some general opImplicitCast it might be better described as opImplicitConstCast.

--
December 04, 2022
https://issues.dlang.org/show_bug.cgi?id=23523

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick@geany.org

--- Comment #2 from Nick Treleaven <nick@geany.org> ---
> Similarly, allow `immutable type!T` to convert to `type!(immutable T)`

That isn't always safe:

struct S(T)
{
    int* p;
}

void main()
{
    auto s = S!(immutable int)();
    immutable si = S!int();
    s = si; // currently an error
    *s.p = 4;
    assert(*si.p == 0); // fails
}

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=23523

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
December 13
https://issues.dlang.org/show_bug.cgi?id=23523

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/18139

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--