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


hst...@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hst...@quickfur.ath.cx


--- Comment #12 from hst...@quickfur.ath.cx 2012-04-30 17:21:24 PDT ---
(In reply to comment #10)
[...]
> 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.

You're totally missing the point. Code like this is very prone to bugs:

int[5] x = [1,2,3,4,5];

because as soon as somebody edits the list of elements, the count will be
wrong. Restating something that the compiler already knows is a bad idea. (The
same problem occurs in C/C++; in the C case, depending on the compiler, you may
even get a gratuitous array overrun.)

The proposed int[$] = [ ... ]; is a very good solution, because $ already means
"length of array" in D, and would fit seamlessly into the existing language.

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

Reply via email to