associative arrays

Kapps Kapps at NotValidEmail.com
Sun Jan 8 01:24:22 PST 2012


Ah, found the bug / pull request.

https://github.com/D-Programming-Language/dmd/pull/597
http://d.puremagic.com/issues/show_bug.cgi?id=4523

On 08/01/2012 1:39 AM, Kapps wrote:
> For most languages (such as C# and maybe Java), the Remove method on
> collections returns a boolean indicating whether it was removed. So you
> could write:
>
> enforce(MyAA.remove("lenght"))
> or
> bool Result = MyAA.remove("lenght");
> assert(Result);
>
> I'm not sure why it doesn't in D, but I thought I remembered seeing a
> pull request or change that added it. Maybe I'm imagining things since I
> can't find it now.
>
> On 07/01/2012 4:11 PM, RenatoL wrote:
>> Very quick question
>>
>> import std.stdio;
>> void main()
>> {
>> auto arr1 = ["uno":1, "due":2, "tre":3];
>> arr1.remove("xxx");
>> }
>>
>> also in this case the compiler does not say anything and the
>> program goes out silently ... why? Would not it be better if an
>> exception was raised? After all if i write:
>>
>> writeln(arr1["xxx"]);
>>
>> runtime expresses its disappointment...
>



More information about the Digitalmars-d-learn mailing list