digitalmars.D - Non-null analysis in Java
- Somedude (12/12) Dec 11 2011 Just for the record, non-null static and runtime analysis is implemented
- deadalnix (10/22) Dec 11 2011 We definitively should have a non nullable type in D. Null check are:
- =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= (5/33) Dec 11 2011 I think the idea with D's @disable attribute on default struct
- deadalnix (4/44) Dec 11 2011 Definitively, it should be done the other way around : Non null by
- Timon Gehr (3/43) Dec 11 2011 D cannot support library NonNull types because there is no way to get
- bearophile (15/20) Dec 12 2011 It looks very nice.
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.
Dec 11 2011
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
Dec 11 2011
On 11-12-2011 14:18, deadalnix wrote:Le 11/12/2011 11:29, Somedude a écrit :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. - AlexJust 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
Dec 11 2011
Le 11/12/2011 14:19, Alex Rønne Petersen a écrit :On 11-12-2011 14:18, deadalnix wrote:Definitively, it should be done the other way around : Non null by default, and Nullable!(T) in the standard lib. Most of the time, you don't want null, and have to check them.Le 11/12/2011 11:29, Somedude a écrit :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. - AlexJust 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
Dec 11 2011
On 12/11/2011 02:19 PM, Alex Rønne Petersen wrote:On 11-12-2011 14:18, deadalnix wrote:D cannot support library NonNull types because there is no way to get initialization right.Le 11/12/2011 11:29, Somedude a écrit :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. - AlexJust 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
Dec 11 2011
Somedude: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 eclipseIt looks very nice. Instead of that Java syntax: NonNull Object foo( NonNull Object x) {... For D2 I have suggested a more handy and short syntax, a trailing means non-null: object foo(object x) {... A leading (usually optional, because it's the default, but in some situations you need to use it) ? means nullable: object? foo(object? x) {... The question mark is useful in some situations: Foo foo = new Foo(); // foo is non-null auto f = cast(?)foo; // cast to nullable Some notes here: http://d.puremagic.com/issues/show_bug.cgi?id=4571 Bye, bearophile
Dec 12 2011