Bug 15753 – clear method for AA not work

Status
RESOLVED
Resolution
INVALID
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2016-03-04T13:11:00Z
Last change time
2016-03-04T16:48:16Z
Assigned to
nobody
Creator
yosikawa

Comments

Comment #0 by yosikawa — 2016-03-04T13:11:06Z
"associative array" page of the language reference clearly denotes: All keys can be removed by using the method clear. But following code won't compile. void main() { string[string] hash = [ "k":"v" ]; hash.clear(); } main.d(3): Error: no property 'clear' for type 'string[string]'
Comment #1 by schveiguy — 2016-03-04T15:48:34Z
This is a recent addition. What compiler/version are you using?
Comment #2 by schveiguy — 2016-03-04T15:55:27Z
Actually, latest release (2.070) does not have this. It's only in master. I don't know why the site documentation is updated early. It will be present in 2.071.
Comment #3 by yosikawa — 2016-03-04T16:37:20Z
(In reply to Steven Schveighoffer from comment #1) > This is a recent addition. What compiler/version are you using? >dmd --version DMD32 D Compiler v2.070.2 Copyright (c) 1999-2015 by Digital Mars written by Walter Bright -- aki.
Comment #4 by schveiguy — 2016-03-04T16:48:16Z
OK, thanks. As I said, 2.071 will have this feature. Sorry the documentation was released too early.