Is D 0.163 D 1.0?

Andrei Khropov andkhropov at nospam_mtu-net.ru
Sun Jul 23 17:33:23 PDT 2006


And what about double meaning of 'auto'?

It's a longstanding issue and changes could break lots of code, but I think it's
a terrible design inconsistency.

And it also currently means that we cannot use type inference with auto classes
(which is also inconsistensy by itself)

------------------------------------------------
import std.stdio;

auto class X
{
public:
    int _i;
    
    this(int i1)
    {
        _i = i1;
    }
    
    int i()
    {
        return _i;
    }
    
    ~this()
    {
      writefln("destructor i=",_i); 
    }
}

void main()
{
    auto X x1 = new X(1);
    
    //auto auto x2 = new X(2); // auto1.d(28): redundant storage class 'auto'
    
    // auto x3 = new X(3); // auto1.d(30): variable auto1.main.x3 reference to
auto class must be auto
    
    writefln("x1.i=",x1.i);
    //writefln("x2.i=",x2.i);
    //writefln("x3.i=",x3.i);
}
---------------------------------------------------

Some discussion was here: 
http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/38443

(I personally vote for 'var' for type inference)

-- 
AKhropov



More information about the Digitalmars-d mailing list