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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 31 10:48:33 PDT 2013


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


Shriramana Sharma <samjnaa at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |samjnaa at gmail.com


--- Comment #21 from Shriramana Sharma <samjnaa at gmail.com> 2013-05-31 10:48:29 PDT ---
(In reply to comment #16)
> (In reply to comment #14)
> > 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 :-|

I support the ... syntax to indicate an incomplete array specification for a
fixed-size array. Of course, the T[$]= syntax prescribed by bug 481 should not
be used with this syntax since they conflict.

1) IMHO absence of a comma between two items inside an array literal should be
treated as an error.

2) However, at the end of the specified elements of an array literal, a comma
may or may not be present before the ... and it should NOT make any difference
-- all the remaining objects should be initialized to T.init. Making a semantic
difference on the small distinction between 3,... and 3... would be a bad
decision IMHO.

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