[Issue 3849] [missing error] Array literal length doesn't match
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 28 12:21:52 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3849
--- Comment #8 from bearophile_hugs at eml.cc 2010-10-28 12:20:43 PDT ---
(In reply to comment #6)
> It isn't an array literal, it's a static initializer. They look the same, but
> are distinct entities with distinct rules.
General design rule: if you want to minimize traps and bugs, then to represent
a different entity you need a different syntax.
Currently this program compiles:
int[4] a = [1, 2, 3];
void main() {}
While this generates:
object.Exception: lengths don't match for array copy
void main() {
int[4] a = [1, 2, 3];
}
This looks like a corner case that's better to remove from D. In this bug
report there are syntaxes that restore the needed flexibility.
--
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