Current sentiment on Nullable.get

FeepingCreature feepingcreature at gmail.com
Tue Dec 11 06:42:19 UTC 2018


On Monday, 10 December 2018 at 17:43:40 UTC, Jonathan M Davis 
wrote:
> However, IIRC, someone already tried to deprecate the alias and 
> ran into a compiler bug that prevented it - though 
> unfortunately, I can't find the bug report at the moment. I 
> recall it being an issue with getting deprecation messages from 
> the alias even when it wasn't used explicitly, but when I try a 
> simple test case, I get a different bug entirely. This code 
> snippet
>
> struct S
> {
>     int get()
>     {
>         return 42;
>     }
>
>     deprecated alias get this;
> }
>
> void main()
> {
>     S s;
>     int i = s;
> }
>
> doesn't result in any deprecation messages at all. Based on 
> that, without some compiler fixes, it's not actually possible 
> to deprecate the alias.
>
> - Jonathan M Davis

Deprecating get() works, for what it's worth. So the way to go 
would be changing Nullable to alias deprecated_get_ this;


More information about the Digitalmars-d mailing list