Thread overview
[Issue 4523] New: .remove method for Associative Arrays returns void in all cases
Jul 28, 2010
Andrej Mitrovic
Jul 28, 2010
Andrej Mitrovic
Jul 28, 2010
Don
[Issue 4523] TDPL .remove method for Associative Arrays returns void in all cases
Dec 22, 2010
Andrej Mitrovic
[Issue 4523] [tdpl] .remove method for Associative Arrays returns void in all cases
Jan 02, 2012
Kenji Hara
Jan 09, 2012
Walter Bright
July 28, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4523

           Summary: .remove method for Associative Arrays returns void in
                    all cases
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2010-07-27 18:13:49 PDT ---
Example code errors out due to the .remove method returning void. This method should return boolean true if the key was in the associative array, or false otherwise:

void main() {
   int[string] array = ["test":0, "test2":1];

   bool found = array.remove("test");
   bool notfound = array.remove("nothing");
}

Errors:
assoc_test.d(6): Error: expression array TOK44 "test" is void and has no value
assoc_test.d(7): Error: expression array TOK44 "nothing" is void and has no
value

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 28, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4523



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2010-07-27 18:16:27 PDT ---
(In reply to comment #0)
> Example code errors out due to the .remove method returning void. This method should return boolean true if the key was in the associative array, or false otherwise:
> 
> void main() {
>    int[string] array = ["test":0, "test2":1];
> 
>    bool found = array.remove("test");
>    bool notfound = array.remove("nothing");
> }
> 
> Errors:
> assoc_test.d(6): Error: expression array TOK44 "test" is void and has no value
> assoc_test.d(7): Error: expression array TOK44 "nothing" is void and has no
> value

I forgot to add that TDPL states this on page 116.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 28, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4523


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic, wrong-code
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-07-27 21:26:19 PDT ---
Also TOKxxx should never appear in any error message.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 22, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4523



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2010-12-22 11:45:22 PST ---
The TOKxxxx messages are gone in 2.051, but AA's remove method still returns void.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4523


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2012-01-01 22:57:46 PST ---
https://github.com/D-Programming-Language/dmd/pull/597 https://github.com/D-Programming-Language/druntime/pull/111

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 09, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4523


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2012-01-08 22:51:08 PST ---
https://github.com/D-Programming-Language/dmd/commit/1f14a6e0e8ebf51c8b653e5eef7fae0ba4b2889c

https://github.com/D-Programming-Language/dmd/commit/3e23b0f5834acb32eaee20d88c30ead7e03bb2f4

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