delete hash[key] deprecated???

Koroskin Denis 2korden+dmd at
Sat Jul 19 07:37:28 PDT 2008

On Sat, 19 Jul 2008 16:39:18 +0400, Stewart Gordon <smjg_1998 at>  

> But .remove has to return something.  So how is this possible?

It doesn't return anything now.

> And what would remove do if the key is already not in the AA?  Return 
> ValueType.init?  Throw an exception?

I think returning null is ok. Otherwise a redundant check and a lookup  
will be necessary:

Object[char[]] map;
if (auto o = "test" in map) { // this is redundant, in my opinion
     delete map.remove("test");

and it is exactly the same as:

if (auto o = "test" in map) {
    delete *o;

More information about the Digitalmars-d-learn mailing list