[Issue 4410] AA has inconsistent and unreasonable requirements for iterating over reference-type index

2022-08-16 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4410

Steven Schveighoffer  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #6 from Steven Schveighoffer  ---
I wrote this so so long ago. I'm not sure this bug is relevant any more.

Problems still do exist with keys being not-constant for reference types
(classes), but iteration is not the problem there.

--


[Issue 4410] AA has inconsistent and unreasonable requirements for iterating over reference-type index

2022-08-15 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4410

RazvanN  changed:

   What|Removed |Added

 CC||razvan.nitu1...@gmail.com

--- Comment #5 from RazvanN  ---
Apart from the first foreach, the rest do not compile today. You can only ref
an aa key if it is const. This makes sense in my opinion. @Steven, what else
needs to be done to consider this issue fixed?

--


[Issue 4410] AA has inconsistent and unreasonable requirements for iterating over reference-type index

2013-08-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4410


hst...@quickfur.ath.cx changed:

   What|Removed |Added

 CC||hst...@quickfur.ath.cx


--- Comment #4 from hst...@quickfur.ath.cx 2013-08-15 09:56:29 PDT ---
AA keys only need to be immutable in the parts that are relevant to the hash
function. For example, if a class object's toHash method simply casts 'this' to
an integer value, then it doesn't matter what you change in the class, the AA
will still work. Similarly, if a class object's toHash method computes a hash
only on members x, y, z, then it's OK to change member variable w without
breaking the AA.

The only time you actually require immutability in AA keys is when you use the
default hash function that computes a hash over the binary representation of
the entire key.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4410] AA has inconsistent and unreasonable requirements for iterating over reference-type index

2010-07-02 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4410



--- Comment #3 from Steven Schveighoffer  2010-07-02 
05:15:40 PDT ---
(In reply to comment #2)
> Obviously, AA keys must be immutable.

Making all array keys immutable is pretty restrictive as well.  I don't want to
see that happening either.  I don't know if you've tried to work with immutable
classes, but they are not that easy.

A recommendation that they be immutable when possible is probably in order. 
But making them const is worse than immutable because it provides no guarantees
and is still as annoying.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4410] AA has inconsistent and unreasonable requirements for iterating over reference-type index

2010-07-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4410


nfx...@gmail.com changed:

   What|Removed |Added

 CC||nfx...@gmail.com


--- Comment #2 from nfx...@gmail.com 2010-07-01 18:58:51 PDT ---
Obviously, AA keys must be immutable.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4410] AA has inconsistent and unreasonable requirements for iterating over reference-type index

2010-07-01 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4410



--- Comment #1 from Steven Schveighoffer  2010-07-01 
05:53:32 PDT ---
(In reply to comment #0)
> first, ref should *never* be allowed as an index for AAs.  I hope that someday
> this can be extended to all user types (see related bug 2443).

...

> Also, as mentioned, ref indexes should not be allowed.  This used to be the
> case, not sure why it was changed.

I should clarify, I mean ref indexes during foreach.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---