[Issue 16394] TypeInfo.init() for static arrays returns single element instead of whole array

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Aug 15 22:19:13 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16394

--- Comment #9 from Eyal <eyal at weka.io> ---
> Or functioning as designed, just not properly documented.

> This part of TypeInfo is meant to be used internally. I don't think this corner case warrants a compiler change, as the current state is completely usable.

Not by Weka or by Andrei Alexandrescu, apparently, as both inserted terrible
bugs into production code with this.

Do you think a warning in the manual would have prevented these bugs? Do you
doubt that the next usages of this function will create similar bugs?

> Every time we change the compiler, it may break other things. I don't think it's worth the risk for such a small improvement. Not to mention it will bloat all object files. Why break things for the vast majority of people when the fix is simple for those who have been misled by the incomplete docs?

Note the "fix" I am requesting does not require bloating the object files. A
compile-time error about use of the "init" value of a static array's typed id
is enough.  Generating a special TypeInfo object for static arrays doesn't
sound like rocket science.


Claiming the interface should be terrible to simplify the implementation is
classic worse-is-better, and I think D aspires to be truly better.

--


More information about the Digitalmars-d-bugs mailing list