On 5/18/2013 5:23 PM, deadalnix wrote:
On Sunday, 19 May 2013 at 00:14:26 UTC, Walter Bright wrote:

    this() { assert(0); }

makes for a runtime check, not a compile time one. Compile time checks are
more efficient in both programmer time and run time.

Note that C++11 8.4.3 has @disable as well, in the form:

   S() = delete;


D has @disable. If default constructor are allowed, default constructor can be
disabled, as any other declared symbol.

I understand that. But the rationale you gave for having a default constructor was to be able to disable default construction.


With NotNull, the runtime check only happens upon assignment and
initialization from a pointer type. Dereferencing, copying, etc., of NotNull
entails zero runtime overhead and no checks.

People go for the shortest path. You end up having nullable everywhere.
Experience have been a countless amount of time in bazillion programming
languages. But it is probably too late to fix this in D anyway.

I know that some languages have a special syntax for non-null pointers. I disliked this solution for D because non-nullable pointers are just one instance of creating a type with a limited set of values. Why not go for a general solution? Why not create a mechanism where a type can be defined that can only consist of prime numbers, for example? Why not ranged integer types?

Reply via email to