D - Unsafe and doomed

Walter Bright newshound2 at digitalmars.com
Sat Jan 4 14:06:14 PST 2014


On 1/4/2014 12:24 PM, deadalnix wrote:
> On Saturday, 4 January 2014 at 20:16:29 UTC, Walter Bright wrote:
>> On 1/4/2014 11:41 AM, bearophile wrote:
>>> If you write an IDE in D language you wish to avoid this situation :-)
>>
>> If you write an IDE in any language, you wish to avoid having bugs in it. I
>> know that non-NULL was popularized by that billion dollar mistake article, but
>> step back a moment.
>>
>> Non-NULL is really only a particular case of having a type with a constrained
>> set of values. It isn't all that special.
>
> If you step back one step further, you'll notice that having a nullable type may
> be desirable for almost anything, not only classes/pointers.

I don't really understand your point. Null is not that special.

For example, you may want a constrained type:

1. a float guaranteed to be not NaN
2. a code point guaranteed to be a valid code point
3. a prime number guaranteed to be a prime number
4. a path+filename guaranteed to be well-formed according to operating system rules
5. an SQL argument guaranteed to not contain an injection attack

The list is endless. Why is null special?


More information about the Digitalmars-d mailing list