byKey and byValue: properties or methods?

bearophile bearophileHUGS at lycos.com
Wed Jan 18 09:54:49 PST 2012


Steven Schveighoffer:

> There is one significant problem with changing aa.keys to be a lazy range  
> instead of an array.  This is valid code (and does exist in the wild):
> 
> foreach(k; aa.keys)
> {
>     if(shouldRemove(k))
>        aa.remove(k);
> }
> 
> This would silently start crashing programs if we changed the behavior of  
> keys.

On this topic see also:
http://d.puremagic.com/issues/show_bug.cgi?id=4179

Bye,
bearophile


More information about the Digitalmars-d mailing list