AA default value?

Jason House jason.james.house at gmail.com
Fri Jan 25 06:39:16 PST 2008


Janice Caron Wrote:

> The big problem for me with associative arrays is that I often have to
> write ugly code like:
> [snip]
> if the key was not present in the array? Or perhaps an even more
> exotic syntax like
> 
>     auto val = aa[key; defaultValue];
> 
> might work.

If the behavior is defined at the location of the index call, I'd be very happy with adding exotic syntax similar to what you propose.  Another candidate would be to make behavior with invalid indexing a policy that's included in the AA definition.



More information about the Digitalmars-d mailing list