Keyword to avoid not null references
Adam D. Ruppe
destructionator at gmail.com
Mon Apr 23 07:50:11 PDT 2012
On Monday, 23 April 2012 at 14:31:05 UTC, Namespace wrote:
> Yes, that's what i wrote a site before. Otherwise you couldn't
> use it in other modules, that's right.
yeah i'll fix that next time i work on it.
> I wouldn't write for all the objects which i would check
> "method_with_not_null_object(ConvertToNotNull(f_obj));"
The idea is to use NotNull!T to store your stuff,
so there's no need to convert.
> Why this reluctance against a keyword to check a normal Object
> which is passed as parameter, e.g. @notNull Foo f?
Because the hardware already does that, for the most part.
That's what "access violation" means.
The hard part is figuring out /why/ it is null, and the
not null type helps that by catching it when you store
it instead of when you use it.
More information about the Digitalmars-d-learn
mailing list