Deprecated Nullable.get warning with Appenders

rbscott tjonsies818 at yahoo.com
Fri Jan 31 01:13:41 UTC 2020


Hello,

I was scratching my head with this warning for a while until I 
was able to figure out what was causing it. The repro case is 
pretty simple: (The challenge is the error doesn't point you to 
where the problem is occuring).

```
import std.array : appender, Appender;
import std.typecons : Nullable;

struct StructWithNullable {
     Nullable!(string) nullableString;
}

void main()
{
     Appender!(StructWithNullable[]) structWithNullableAppender;
     structWithNullableAppender.put(StructWithNullable.init);
}
```

On the playground this prints the following warnings:

```
/dlang/dmd/linux/bin64/../../src/phobos/std/traits.d(3688): 
Deprecation: function std.typecons.Nullable!string.Nullable.get_ 
is deprecated - Implicit conversion with alias Nullable.get this 
will be removed after 2.096. Please use .get explicitly.
/dlang/dmd/linux/bin64/../../src/phobos/std/traits.d(3689): 
Deprecation: function std.typecons.Nullable!string.Nullable.get_ 
is deprecated - Implicit conversion with alias Nullable.get this 
will be removed after 2.096. Please use .get explicitly.
```

I think this is something to do with the Appender library, but 
after looking into the logic for the put method, I couldn't wrap 
my head around what was wrong. Happy to help however possible. 
With some guidance, I could put together a PR for Appender.

thanks!
rbscott


More information about the Digitalmars-d mailing list