http://d.puremagic.com/issues/show_bug.cgi?id=481



--- Comment #11 from bearophile_h...@eml.cc 2012-04-30 17:04:35 PDT ---
(In reply to comment #10)

> Sorry to be blunt here but this whole discussion is absolutely pointless and
> should be closed as WONTFIX right now. People have better things to do.

It's relevant, also because there are 6 votes.


> If some dude can't count the number of elements he puts in his 10 elements
> array initializer, he'd better stop programming at all. Introducing some
> strange Perl-like syntax for that is madness.

Thank you for your note, it allows me to better express why this issue
relevant.

It's not DRY (http://en.wikipedia.org/wiki/DRY ), and duplicated information
tends to get out of sync (and this causes bugs).

You write (think of a as a longer array):

int[5] arr = [1,2,3,4,5];
void main() {}

Later you change the code and your remove on item from the literal, but you
forget to update the array size on the left:

int[5] arr = [1,2,4,5];
void main() {}

The compiler gives you no error nor warning, and arr actually contains
[1,2,4,5,0]. This is a source of bugs, it has happened to me too.

With a syntax like [$] or []S it can't happen, because the length is not stated
twice.

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

Reply via email to