Initializing assoc array to non-null

Jonathan M Davis jmdavisProg at gmx.com
Sat Jun 1 09:20:36 PDT 2013


On Saturday, June 01, 2013 21:45:26 d coder wrote:
> Thanks Jonathan
> 
> Do you think this could make a good enhancement request?

Yes. There are some key things like that in AAs that should be improved. 
There's also no way to clear an AA. There are people who call clear (which has 
now be renamed to destroy), but that just nulls the reference. To truly clear 
it, you have to actually manually remove all of the elements, which isn't 
exactly ideal.

I know that Don has argued that AAs shouldn't be null by default, but that 
changing that might break existing code in subtle ways and wouldn't play nice 
with CTFE as it currently stands. We do need a better way to handle it though.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list