On Thursday, 28 March 2013 at 10:34:35 UTC, Timon Gehr wrote:
On 03/28/2013 04:18 AM, deadalnix wrote:
On Wednesday, 27 March 2013 at 18:20:49 UTC, Andrei Alexandrescu wrote:
On 3/27/13 1:23 PM, Timon Gehr wrote:
- Function that never return are inferred void. I would have preferred typeof(null) as void lead to many static and repetitive code for
nothing
when doing metaprograming.

I strongly disagree.

Ideally such function should return a "none" type, the bottom of the hierarchy lattice. We don't have such, so returning typeof(null) (which we do have) is the next best choice as it's just above bottom.


I thought that typeof(null) was that bottom type. What is the difference ?


There is a huge difference.

- typeof(null) is a subtype of all _class, interface and pointer_
   types because they all _include_ its value, null.

- bottom is a subtype of _all_ types, because there is _no_ value of
   type bottom.


OK I see the difference.

Anyway, void isn't the right choice here and is a pain to work with.

typeof(null) would be worse.

I don't see how it is worse.

Reply via email to