DIP 1017--Add Bottom Type--Community Review Round 1

Stefan Koch uplink.coder at googlemail.com
Fri Aug 10 23:40:03 UTC 2018


On Friday, 10 August 2018 at 13:15:46 UTC, Dukc wrote:
> On Friday, 10 August 2018 at 12:42:37 UTC, Nicholas Wilson 
> wrote:
>>> meant is(typeof(*null) == typeof(assert(0)))
>>
>> How is that a good thing??? Also that is not specified in the 
>> dip. I would expect that to fail because both will produce 
>> error nodes in the AST, only assert(0) is considered special 
>> under this DIP.
>
> Granted, an example like that should be described so we know 
> better what he means with the possible future uses.
>
> The benefit would be that null can be a regular pointer 
> constant (enum null = typeof(&assert(false)).init) instead of a 
> symbol with special meaning. I'd think it makes compiler rules 
> less complex.
>
> Another advantage is that you could pass null as an argument 
> for a function template which wants to know it's element type 
> (but of course not instantiate it) like any other pointer.

No that cant be happing, retuning null is still returning 
something.
as opposed to not returning.


More information about the Digitalmars-d mailing list