Which D features to emphasize for academic review article
Simen Kjaeraas
simen.kjaras at gmail.com
Tue Aug 14 07:45:55 PDT 2012
On Tue, 14 Aug 2012 16:32:25 +0200, F i L <witte2008 at gmail.com> wrote:
> class Foo
> {
> float x; // I think this should be 0.0f
> // Walter thinks it should be NaN
> }
>
> In this situation static analysis can't help catch issues, and we're
> forced to rely on a default value of some kind.
Really? We can catch (or, should be able to) missing initialization
of stuff with @disable this(), but not floats?
Classes have constructors, which lend themselves perfectly to doing
exactly this (just pretend the member is a local variable).
Perhaps there are problems with structs without disabled default
constructors, but even those are trivially solvable by requiring
a default value at declaration time.
--
Simen
More information about the Digitalmars-d
mailing list