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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 13 04:29:10 PDT 2011


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



--- Comment #18 from bearophile_hugs at eml.cc 2011-09-13 04:28:51 PDT ---
(In reply to comment #17)

I have suggested to introduce the "..." syntax for arrays just because Walter
thinks global arrays are often initialized partially. Some evidence shows this
is a really uncommon need, so maybe it doesn't deserve a special syntax and it
doesn't deserve to leave a trap in D that's a confirmed (by Don too) source of
bugs. Don also has suggested a library solution that maybe makes "..." useless
or less needed.


> For what more valuable purpose do you wish to save the syntax I proposed? :)

The first and main purpose of the "..." syntax is to denote a global/static
fixed-sized array that is underspecified (and all items not specified default
to T.init).

You propose to add a secondary purpose to the "..." syntax, that allows to
specify what's the value of all the not specified items, to ask for a value
different from T.init. I have seen not even one use case for this sub-feature,
this is bad for this idea.

I my note about engineers I have tried to explain that engineers often have
aversion of designs that conflate two different purposes into a single "user
interface", especially if one of the purposes isn't a confirmed need and if it
creates problems when it's used alongside other features (floating point
numbers without leading digits). So I fear that the appreciation of Walter of
this idea is _decreased_ by the idea of adding this sub-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