D2's feature set?
Steven Schveighoffer
schveiguy at yahoo.com
Sat Jun 6 08:17:03 PDT 2009
On Sat, 06 Jun 2009 09:35:15 -0400, Christopher Wright
<dhasenan at gmail.com> wrote:
> Kristian Kilpi wrote:
>> I think I shouldn't post this because I could very well start one of
>> those mega-threads... :D
>> Of course, only Walter & Co know what D2 will include when it's
>> finally 'released'. Concurrency stuff has been developed lately. But
>> something more? Or is that it? What do you think?
>> I haven't thought about it too much, but lets say something... ;)
>> 1) Scoped members. For example:
>> class Foo
>> {
>> scope Bar bar; // gets destructed with Foo object
>> }
>
> You need to do escape analysis and whole program analysis to determine
> whether there are aliases to a scope member. Failing that, it's pretty
> easy to introduce bugs that are difficult to find.
Not really. A scope member would be placed in the same memory block as
the owner class. So an alias to the member would be the same as an alias
to the owner class because the same memory block would be referenced.
Both wouldn't be collected until neither is referenced.
It's the equivalent of this in C++:
class Bar
{
}
class Foo
{
Bar bar;
}
The only issue left to decide is how the member is initialized. There
must be some rules, like if bar has no default constructor, it must be
new'd in the constructor. And it can't be rebound.
-Steve
More information about the Digitalmars-d
mailing list