[Issue 6722] Can't remove a char[] key from an AA with immutable(char)[] key type.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 12 12:35:59 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6722
Stewart Gordon <smjg at iname.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
CC| |smjg at iname.com
Platform|Other |All
OS/Version|Linux |All
--- Comment #2 from Stewart Gordon <smjg at iname.com> 2012-02-12 12:35:58 PST ---
A char[] can be safely compared with an immutable(char)[], so the code should
be valid.
Putting a value into an AA is another matter though.
(In reply to comment #1)
> The simplest solution is to just make it so that it's illegal to
> declare an AA with a key which isn't either a value type or
> immutable
Agreed.
> and make it so that _all_ functions or operators which take the key
> must take a type which is implicitly convertible to the key type
> (including its immutability).
For functions that put data into an AA, yes.
For lookup functions (retrieval and removal), it should be sufficient that it's
a type that is implicitly convertible to the const version of the key type.
(Just having an == operator with the key type isn't sufficient, as it needs to
check the hash first.)
For foreach, the only requirement should be that the key variable is of a type
to which the key type can be implicitly converted.
But this is a distinct matter from this bug.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list