[article] Language Design Deal Breakers

Simen Kjaeraas simen.kjaras at gmail.com
Tue May 28 12:17:44 PDT 2013


On Tue, 28 May 2013 21:04:50 +0200, deadalnix <deadalnix at gmail.com> wrote:

> On Tuesday, 28 May 2013 at 15:56:57 UTC, Simen Kjaeraas wrote:
>> Specifically, non-nullable pointers solve the problem of initializing
>> *pointers*, while @disable this() solves the problem of initializing
>> *anything*.
>>
>
> NonNull imply the exact same thing for the compiler as you can have  
> compound type containing pointers. NonNull pointer imply as well  
> initializing anything. Compilerwise, it is the exact same thing.

So you're saying I should do this to get a guaranteed prime number:

struct Prime {
    private int payload;
    private void* dummy; // Non-nullable

    this(int value) {
       assert(isPrime(value));
       dummy = &something;
       dummy = value;
    }
}

Seriously? I'm not willing to believe you mean that, but if you really
think non-nullable pointers is the same as @disable this(), I'm forced to.


-- 
Simen


More information about the Digitalmars-d mailing list