Walter Bright wrote:
3. Floating point values are default initialized to NaN.

This isn't a good feature, IMO. C# handles this much more conveniently with just as much optimization/debugging benefit (arguably more so, because it catches NaN issues at compile-time). In C#:

    class Foo
    {
        float x; // defaults to 0.0f

        void bar()
        {
            float y; // doesn't default
            y ++; // ERROR: use of unassigned local

            float z = 0.0f;
            z ++; // OKAY
        }
    }

This is the same behavior for any local variable, so where in D you need to explicitly set variables to 'void' to avoid assignment costs, C# automatically benefits and catches your NaN mistakes before runtime.

Sorry, I'm not trying to derail this thread. I just think D's has other, much better advertising points that this one.

Reply via email to