[D typesystem] What is the type of null?

el muchacho nicolas.janin at gmail.com
Sun Oct 31 00:30:29 PDT 2010


Le 29/10/2010 21:02, Bruno Medeiros a écrit :
> 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...
> 
> 
Hello,

I don't know if it has already been cited here, but this is a good read :
Much Ado About Nothing: Putting Java’s Null in its Place
http://www.ccs.neu.edu/scheme/pubs/dissertation-cobbe.pdf


More information about the Digitalmars-d mailing list