Where are we on getting rid of Nullable's alias this? Was that happening?

Jonathan M Davis newsgroup.d at jmdavisprog.com
Thu May 30 18:23:54 UTC 2019


On Thursday, May 30, 2019 8:39:05 AM MDT aliak via Digitalmars-d wrote:
> Just ran in to this awesome bug
>
> import std;
>
> struct Foo {
>      Nullable!string a;
> }
>
> void main() {
>      string a;
>      auto app = appender(&a);
>      formattedWrite(app, "%s", Foo());
> }
>
> Because this:
> https://github.com/dlang/phobos/blob/master/std/format.d#L3448
>
> Because "StringTypeOf!(Nullable!string) = Nullable!string()"
> calls get implicitly, which assers :/
>
> I'm not sure if there's a workaround. I remember there was talk
> of removing alias this in Nullable? But I also remember there was
> no consensus?

I don't think that there was ever a consensus on it (mostly just one person
being really vocal about IIRC). But regardless, IIRC, what prevented it from
going any further was that deprecating the alias resulted in deprecation
messages when the alias was checked by the compiler even if it wasn't
actually used in the code, meaning that you got a lot of extraneous
deprecation messages. I believe that the bug was reported, but I don't know
what its status is.

- Jonathan M Davis





More information about the Digitalmars-d mailing list