Is there a weak pointer or references in D?

Charles Hixson charleshixsn at earthlink.net
Sun Jan 13 15:18:37 PST 2013


On 01/12/2013 09:24 PM, Alex Rønne Petersen wrote:
> On 11-01-2013 19:15, Charles Hixson wrote:
>> I was looking for a way to create a weak reference to either a struct or
>> a class. I need to be able to use it to automatically generate an
>> active reference on access. (I intend to do this by rolling in data
>> from a file.)
>>
>> Any guidance as to where I should look?
>
> https://github.com/lycus/mci/blob/master/src/mci/core/weak.d
>
> It has some caveats (see the comments).
>

It certainly does have some caveats.  And according to at least one of 
them it may break badly in the future from a plausible compiler change.

Well, it's what I asked for, but using something that can be expected to 
break without warning.  I want to write code that I can forget after I test.

It would have been a great convenience, but that's a bit too high a 
price to pay for a convenience.



More information about the Digitalmars-d-learn mailing list