www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4523] New: .remove method for Associative Arrays returns void in all cases

reply d-bugmail puremagic.com writes:
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



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: -------
Jul 27 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4523




18:16:27 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
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: -------
Jul 27 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jul 27 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4523




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: -------
Dec 22 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4523


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

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



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: -------
Jan 01 2012
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jan 08 2012