Scott Meyers' DConf 2014 keynote "The Last Thing D Needs"

Jonathan M Davis via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu May 29 00:59:16 PDT 2014


On Thu, 29 May 2014 08:23:26 +0200
Timon Gehr via Digitalmars-d-announce
<digitalmars-d-announce at puremagic.com> wrote:

> In any case, simply reversing the order for static array types using
> an ad-hoc rewrite rule would be a huge wart, even more severe than
> the other points you raised, and we definitely wouldn't be trading
> one kind of consistency for another.

In every other case, array dimensions are read from left-to-right, and thanks
to
    const(int)* foo;

we already threw out the whole idea of types really being read outward from
the variable name, and outside of static arrays, I don't think that we have
anything that would even care if we declared that types were always read
left-to-right. If we had always had static array dimensions be read
left-to-right in their declarations, I very much doubt that you would have
much of anyone complaining about it being inconsistent. If anything, that's
_more_ consistent with everything else. It's just that that doesn't fit with
how C/C++ compilers read types.

The only reason that I don't argue strongly for changing it is the fact that
it would break every existing program which uses multi-dimensional static
arrays, and the breakage would be easy to miss at compile time. So,
unfortunately, I think that we're stuck. But aside from arguing that it's how
C/C++ reads types, I don't see much of an argument for why it makes any sense
for static array dimensions be read from right-to-left in declarations.

- Jonathan M Davis


More information about the Digitalmars-d-announce mailing list