Unexpectedly nice case of auto return type

Basile B. b2.temp at gmx.com
Tue Dec 3 10:23:20 UTC 2019


On Tuesday, 3 December 2019 at 10:19:02 UTC, Jonathan M Davis 
wrote:
> On Tuesday, December 3, 2019 3:03:22 AM MST Basile B. via 
> Digitalmars-d- learn wrote:
>> [...]
>
> There isn't much point in giving the type of null an explicit 
> name given that it doesn't come up very often, and typeof(null) 
> is quite explicit about what the type is. Also, anyone doing 
> much generic programming in D is going to be well versed in 
> typeof. They might not know about typeof(null) explicitly, but 
> they should recognize what it means when they see it, and if 
> someone were trying to get the type of null, it would be the 
> obvious thing to try anyway. And typeof(null) isn't even the 
> prime case where typeof gets used on something other than an 
> object. From what I've seen, typeof(return) gets used far more.
>
> [...]

you're right but I see two cases:

- transpiling
- header generation


More information about the Digitalmars-d-learn mailing list