My thoughts & experiences with D so far, as a novice D coder
Timon Gehr
timon.gehr at gmx.ch
Thu Mar 28 03:34:34 PDT 2013
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.
> Anyway, void isn't the right choice here and is a pain to work with.
typeof(null) would be worse.
More information about the Digitalmars-d
mailing list