important proposal: scope keyword for class members
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sat Mar 7 08:24:11 PST 2009
Sean Kelly wrote:
> John Simon wrote:
>> I'd like to propose a new use for the 'scope' keyword within an
>> aggregate body.
>>
>> Members of class type declared with the scope keyword are allocated
>> not as references or pointers, but initialized directly inside the
>> container. Instead of a default initializer of 'null', it will
>> initialize with the default constructor of the class, or an optional
>> assignment after the declaration. Any 'new [type]' within the
>> assignment will resolve to a simple call to the type's __ctor, instead
>> of a memory allocation.
>
> A while back, Walter said that he planned to do exactly this. I'm not
> sure what the timetable is though, or if plans have changed.
I'd be happier if we investigated scope in classes as an ownership
mechanism. In-situ storage is nice, but ownership management is more
important.
Andrei
More information about the Digitalmars-d
mailing list