On 12/11/2011 02:19 PM, Alex Rønne Petersen wrote:
On 11-12-2011 14:18, deadalnix wrote:
Le 11/12/2011 11:29, Somedude a écrit :
Just for the record, non-null static and runtime analysis is implemented
in a number of Java projects.

http://eclipseandjazz.blogspot.com/2011/12/inter-procedural-null-analysis-using.html


Anotation based Static analysis for eclipse

* javax.validation.constraints.NotNull
Created for runtime validation, not static analysis.

* edu.umd.cs.findbugs.annotations.NonNull
Static analysis

* com.intellij.annotations.NotNull
Used by IntelliJ IDEA IDE for static analysis.

* lombok.NonNull
Annotation used to control code generation in Project Lombok.

We definitively should have a non nullable type in D. Null check are:
- Easy to forget, leading to catastrophic results when forgotten.
- Crippling the codebase at an alarming speed if you want reliable code.

Plus, when an error occurs with null, it is usually hard to track and
solve, because you have to understand how that b****y variable ends up
being null.

Arguably, things should be non nullable by default.

Tony Hoare (inventor of null ?) recently gave this conference :
http://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare



I think the idea with D's @disable attribute on default struct
contructors is to allow implementing a NoNull type. Still, I'd prefer
having it in the language.

- Alex

D cannot support library NonNull types because there is no way to get initialization right.


Reply via email to