Denis Koroskin wrote:
On Fri, 05 Nov 2010 23:44:58 +0300, Walter Bright <[email protected]> wrote:

To eliminate null pointers is the same as shooting the canary in your coal mine because its twitter annoys you.

I'm tired of pointing out that NO ONE is talking about eliminating null pointers, but rather extending an existing type system to support non-nulls. Your hate towards non-nullables comes from misunderstanding of the concept.

Consider non-nullable type T:

  T[] a = new T[4];
  ... time goes by ...
  T[1] = foo;
  T[3] = bar;
  ... more time goes by ...
  bar(T[2]);

In other words, I create an array that I mean to fill in later, because I don't have meaningful data for it in advance. What do I use to default initialize it with non-nullable data? And once I do that, should bar(T[2]) be an error? How would I detect the error?

In general, for a non-nullable type, how would I mark an instance as not having meaningful data?

For example, an int is a non-nullable type. But there's no int value that means "no meaningful value", and this can hide an awful lot of bugs.

I'm not sure at all that non-nullable types do more than make easy to find bugs much, much harder to find.

Reply via email to