References in D

Franciszek Czekała" <home at valentimex.com> Franciszek Czekała" <home at valentimex.com>
Wed Oct 3 11:37:13 PDT 2012


On Wednesday, 3 October 2012 at 18:12:51 UTC, Henning Pohl wrote:
> class PrimeNumber : Number {
>    this(int i) {
>        // Check whether i is a prime number or not...
>        ....
>
>        super(i);
>    }
>}

This is a good example in that validity of the data can be 
checked from inside the class but not the validity of the 
reference. So indeed these two things are not entirely equivalent 
and references need more of the support from the language. Still 
my point is that, in any program lots of things have to be taken 
on faith. Checking and rechecking everything can sink a Titanic. 
A line has to be drawn somewhere. Program correctness will never 
be syntax based only. Default null references are a very 
reasonable approach. C++ does not check anything and is still 
going strong :). Let's not get paranoid. I'd rather see bug-free 
64bit dmd for windows for the current version of the language and 
some libraries for easy windows programming than endless ideas 
for language additions. D already borders on being too complex.


More information about the Digitalmars-d mailing list