[Issue 3849] Compiler should catch incomplete initialisation of an array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 13 03:15:53 PDT 2011


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



--- Comment #16 from bearophile_hugs at eml.cc 2011-09-13 03:15:30 PDT ---
(In reply to comment #14)

> You don't have to use it then.  You could use
>     float[6] arr = [1., 2., 42. ...];
> or
>     float[6] arr = [1., 2., 42...];
> or
>     float[6] arr = [1., 2., 42.0...];
> 
> instead.

Right, but currently D doesn't require such syntaxes to write floating point
values, so people are free to write the bad syntax, or you have to add one or
more special cases to D.


> with the comma, the remainder of elements
> would be initialised to the type's .init.  A ... following a value without a
> comma would, OTOH, initialise all remaining elements to the specified value.

An engineer usually prefers KISS designs, this also means that language
features serve for only one purpose.
The sub-feature you propose is cute, but I think seen from the eyes of an
engineer it risks reducing the value of the whole ellipsis feature :-|

-- 
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