[Issue 7227] [] syntax for empty associative array too?
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jul 2 00:46:40 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7227
--- Comment #6 from bearophile_hugs at eml.cc 2013-07-02 00:46:28 PDT ---
Having two obvious syntaxes to do the same thing is not so good. So I suggest
to also introduce a warning for the usage of "null" as associative array
literal:
void foo(int[int]) {}
void main() {
foo(null);
int[int][] aas = [null];
aas[0] = [1: 2, 2: 3];
}
=>
test.d(3): Warning: explicit [:] empty associative array literal is better than
null, that will be deprecated
test.d(4): Warning: explicit [:] empty associative array literal is better than
null, that will be deprecated
(The wording of such warning message is modelled on another warning message:
test.d(3): Warning: explicit element-wise assignment (a)[] = 2 is better than a
= 2)
(This warning is not meant to be kept. Later this warning is meant to become a
deprecation, and later an error).
--
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