AA key conversion woes

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Apr 17 11:51:56 PDT 2012


On Tue, Apr 17, 2012 at 08:44:42PM +0200, Andrej Mitrovic wrote:
> On 4/17/12, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:
> > But even then, I'm considering if .keys should return a mutable array if
> > the key is a value type
> 
> How about having .keys for mutable and .ikeys for immutable returns?

That's one possibility. Then .keys can come with the caveat that it may
involve hidden performance costs in the form of internal .dup's. But I'm
not sure this is a good idea, because there are too many string-keyed
AA's in existing code that will now suddenly become very slow because
they use .keys instead of .ikeys, and the strings are getting .dup'd all
over.


T

-- 
There are 10 kinds of people in the world: those who can count in binary, and those who can't.


More information about the Digitalmars-d mailing list