[D typesystem] What is the type of null?

Stanislav Blinov stanislav.blinov at gmail.com
Fri Oct 29 15:17:38 PDT 2010


Bruno Medeiros wrote:
> On 13/10/2010 17:27, retard wrote:
>> Tue, 12 Oct 2010 17:41:05 +0200, Simen kjaeraas wrote:
>>
>>> Justin Johansson<no at spam.com>  wrote:
>>>
>>>>> The answer to the OP's question is simple: null's type is not
>>>>> expressible in D.
>>>>
>>>> That is a sad observation for a language that purports maturity beyond
>>>> the epoch of C/C++/Java et. al.
>>>
>>> I'm curious - why does null need such a specific type?
>>
>> It's much easier to write a specification, a compiler, and an automatic
>> theorem prover for a language with a sane type system. The types and
>> transitions are expressible with simple rules of logic. Now you need ad
>> hoc special cases. Nothing else.
> 
> It may be true that such would make it easier to write an automatic 
> theorem prover, maybe also a specification, but would it really make it 
> easier to write a compiler for such a language?
> And more importantly, even if it was easier, would the language actually 
> be a better and more useful language? Better as in a general-purpose 
> programming language.
> I suspect not, and Justin's implication that D's inability to accurately 
> express the type of null is somehow a severe shortcoming seems to me 
> like wacky formal-methods fanboyism or some other similar crazyness...
> 
> 

AFAIK, N/A is a fairly legit theorem outcome (laws involving infinity, 
or integral of sin(x)/x come to mind).


More information about the Digitalmars-d mailing list