Auto syntax revisited

james james_member at pathlink.com
Tue Feb 21 22:34:21 PST 2006


Could auto also be used in class definitions as well as stack finalisaton of
objects e.g

class X {

// the object is destroyed automatically when the class X is destroyed.
auto A a = new A();
}

I like the additonal control.  If i've declared an object and i know that the
object is definitely NOT referenced by any other variable i want the semantics
and syntax to reflect that. And any performance gains is useful.
So auto would be used for
- stack scoped objects - either the scope co
- object that are 'children' of the class they are declared and should be
destroyed when the parent is destroyed.

Personally i would like the above use of auto and make gc explicit ie:
gc A a = new A();

And re implicit typing use var as c# 3 does:
var a = new A();





More information about the Digitalmars-d mailing list