[Dlang-study] [lifetime] Initial thoughts on lifetime management

Walter Bright walter at digitalmars.com
Wed Oct 28 02:03:36 PDT 2015



On 10/28/2015 1:40 AM, Dmitry Olshansky wrote:
>
> Just a short note on this: COM (which is the backbone of all new WinRT) would 
> be nice to support as well and that means being flexible with where and how 
> reference count is stored. Even putting aside COM & ObjectiveC - in some cases 
> storing ref-counts in a separate block is advantageous and limiting ourselves 
> to hidden embedded ref-count is not necessary.

D already supports COM - just derive from IUnknown.

I don't think it'll be a good idea to base a native rc mechanism on COM, though. 
COM relies on virtual functions to do the ref counting (slow), and of course it 
would interfere with any code that called AddRef or Release directly. I'm not 
sure how it would interact with the large body of existing COM code.


More information about the Dlang-study mailing list