A couple of thoughts/queries.
Robby
robby.lansaw at gmail.com
Wed Dec 12 20:24:33 PST 2007
Frank Benoit wrote:
> Walter Bright schrieb:
>> Robby wrote:
>>> Anyways, what I'm in hopes of finding is a way to tell the compiler
>>> that I never want null, ever. I want an instance of the class and
>>> that's that. The whole idea of taking every lil runtime hit for
>>> checking and the code cruft for writing it when in fact it's
>>> something that seems to be easy for a compiler to do the work for me.
>> The hardware will do the check for null pointer for you every time you
>> do a dereference.
>
> I think he is talking about compile time check.
> Something like non nullable storage class?
Exactly.
Having a storage class 'enforce' that only allows non nullable types
allows has a few advantages as far as I see it.
It's self documenting. It gives a contractual saftey to the implementor
of the method/function. and it removes a lot of the cruft that the
compiler already knows. (which is something I took notice D tends to do
on a lot of other things.)
I know that the general consensus around D tends to be c/c++, but
there's a solid selling point for us Java shops too, and this is one
crufty piece that is littered through our code we'd really like to try
and remove at some point.
More information about the Digitalmars-d
mailing list