null as parametr

Andrew Godfrey via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 31 07:46:23 PDT 2016


On Sunday, 31 July 2016 at 05:41:55 UTC, AntonSotov wrote:
> 2 Seb
>
> Thank you!
> is (T: typeof (null)) - very comfortable

An example of Seb's warning:
What happens if you have:
string s = null;
MyFunc(s);

I'm guessing it doesn't do what you want. But it isn't clear what 
you want - null is a value, not a type. It's just as if you were 
saying:
is (T: typeof (-3))



More information about the Digitalmars-d-learn mailing list