Adventures in D programming
blog.tenstral.net
blog.tenstral.net
Then I ran into this:
https://issues.dlang.org/show_bug.cgi?id=15994
The response to this has almost completely demolished my interest in D. It is with a broken hacker heart that I think I need to step away from D. The problem is not that it's possible to segfault in D or dereference a null pointer in D, as Rust allows this too, but that it's so easy to do so. The worst part is that the response is to blame the learner instead of blaming the language. If I wanted to be blamed, I would go back to C++.
I tried to suggest a language change in IRC, such as for example disallowing bare "SomeClass someobject;" declarations and requiring either "SomeClass someobject = new SomeClass(foo, bar, baz)" or "SomeClass someobject = null;" in order to make it explicit that the reference will be null, but everyone in IRC seemed to think that it was impossible to change the D language. This despite how the language is already constantly changing because as blog post mentions, Phobos is rapidly changing.
I am going to try to raise this concern again in the D mailing list/forum (it's actually really cool these two are the same thing). There are so many good ideas in D, and I really loved everything up until I ran into this. Maybe Walter or Andrei will see the importance of making it more difficult to dereference null pointers.
It would be a significant improvement if it gave a warning when an uninitialized variable is used, but apart from that I wouldn't make any changes here.
If classes can only be references, the syntax should enforce that more clearly. In Java, everything is a reference, so there is less inconsistency there.
I do agree that reading a line like "Blah varName;" is confusing when you don't know what 'Blah' is.