Disadvantages of building a compiler and library on top of a specific memory management scheme

fra a at b.it
Thu Feb 6 10:44:48 PST 2014


On Thursday, 6 February 2014 at 18:18:49 UTC, Andrei Alexandrescu 
wrote:
> On 2/6/14, 9:54 AM, Frustrated wrote:
>> {
>> auto a = new!strategy A;
>>
>> // implicit deallocation: compiler inserts
>> strategy.scopeDeallocation(a);
>> }
>
> I don't think this works. The scope of "strategy" and "a" may 
> be unrelated. More importantly a may be escaped (e.g. by 
> passing it to functions etc) unbeknownst to "strategy", which 
> in fact suggests that the strategy must be somehow known by "a" 
> independently.
Perhaps he meant doing something like: this refence dies here, 
control of the object is now passed to the "Strategy Manager", 
that could be a reference counter that decreases its counter, the 
GC that takes care of everything, and so on.


More information about the Digitalmars-d mailing list