delete hash[key] deprecated???

Stewart Gordon smjg_1998 at yahoo.com
Sat Jul 19 08:25:15 PDT 2008


"Koroskin Denis" <2korden+dmd at gmail.com> wrote in message 
news:op.uejmwq0sn8fdl4 at korden...
> On Sat, 19 Jul 2008 16:39:18 +0400, Stewart Gordon <smjg_1998 at yahoo.com> 
> wrote:
>
>> But .remove has to return something.  So how is this possible?
>
> It doesn't return anything now.

Are you missing my point, or guessing what Max meant?

>> 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:

What if the value type has no null?

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

Indeed, the "auto o =" bit is unnecessary here.

Stewart.

-- 
My e-mail address is valid but not my primary mailbox.  Please keep replies 
on the 'group where everybody may benefit. 



More information about the Digitalmars-d-learn mailing list