Current sentiment on Nullable.get

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Dec 10 17:56:43 UTC 2018


On Mon, Dec 10, 2018 at 10:43:40AM -0700, Jonathan M Davis via Digitalmars-d 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.
[...]

Hmm. I wonder if a circumlocution similar to the following might work?

	struct S
	{
		int get() { return 42; }
		deprecated int deprecatedGet() { return get(); }
		alias deprecatedGet this;
	}

The resulting error message leaves a lot to be desired, though.


T

-- 
"Outlook not so good." That magic 8-ball knows everything! I'll ask about Exchange Server next. -- (Stolen from the net)


More information about the Digitalmars-d mailing list