June 24, 2005
According to the docs:

/ Particular keys in an associative array can be removed with the remove function:/

This says the key is removed, but says nothing about the value. Assuming the value is a class reference or a pointer, is it still referenced internally by the aa after the remove call or not? I don't want to leave any dangling references hanging around, so I need to know if we should be doing something like this:

aa[key] = null;
aa.remove(key);

If the value *is* no longer referenced, then perhaps the docs should be updated to read:

/ Particular key-value pairs in an associative array can be removed with the remove function:/
June 24, 2005
"Mike Parker" <aldacron71@yahoo.com> wrote in message news:d9fql5$qgn$1@digitaldaemon.com...
> This says the key is removed, but says nothing about the value. Assuming the value is a class reference or a pointer, is it still referenced internally by the aa after the remove call or not? I don't want to leave any dangling references hanging around, so I need to know if we should be doing something like this:

I would assume the value is as well.  It wouldn't make much sense for the key to be deleted and the value left, as they are in the same struct.  I think the reference of "key" in the docs in this case refers to the "key-value pair" as you've pointed out.


June 24, 2005
Jarrett Billingsley wrote:
> "Mike Parker" <aldacron71@yahoo.com> wrote in message news:d9fql5$qgn$1@digitaldaemon.com...
> 
>>This says the key is removed, but says nothing about the value. Assuming the value is a class reference or a pointer, is it still referenced internally by the aa after the remove call or not? I don't want to leave any dangling references hanging around, so I need to know if we should be doing something like this:
> 
> 
> I would assume the value is as well.  It wouldn't make much sense for the key to be deleted and the value left, as they are in the same struct.  I think the reference of "key" in the docs in this case refers to the "key-value pair" as you've pointed out. 
> 
> 
I also assume that it does remove the value, as it would be silly not to. But no matter how senseless it would seem, and no matter how much I assume, the docs still say 'key' and not 'key-value pair'. I've been burned by little things like this before (not in D!), so just want it clarified.
Top | Discussion index | About this forum | D home