Herb Sutter briefly discusses D during interview

Vladimir Panteleev vladimir at thecybershadow.net
Tue Jun 7 23:43:20 PDT 2011


On Wed, 08 Jun 2011 04:30:15 +0300, Jonathan M Davis <jmdavisProg at gmx.com>  
wrote:

> On 2011-06-07 17:53, Andrej Mitrovic wrote:
>> I'm not sure what he means when he says that D doesn't simplify syntax.
>
> He talked just before that about simplifying declaration syntax so that  
> it
> reads left-to-right instead of right-to-left, and D didn't do that. For
> instance,
>
> int[4][3] a;
>
> declares a static array of length three where each element of that array  
> is a
> static array of length 4 where each of those arrays holds an integer.  
> It's
> read right-to-left and throws people off at least some of the time.  
> Because,
> when you go to index it, it's used left-to-right
>
> auto a = i[3]; //out-of-bounds
>
> Herb Sutter was suggesting that it would be a big improvement to order
> declaration syntax such that it's read left-to-right (which apparently  
> is what
> Pascal did, and apparently is what Go has done). D stayed closer to C  
> and C++
> and kept the right-to-left declaration synax. That's what he was  
> referring to.
>
> - Jonathan M Davis

I'm really confused by this post.

// Old, C/C++-like syntax - I understand this is pending deprecation
int a[3][4];
static assert(a.length == 3);
static assert(a[0].length == 4);

// New D syntax
int[4][3] b;
static assert(b.length == 3);
static assert(b[0].length == 4);

-- 
Best regards,
  Vladimir                            mailto:vladimir at thecybershadow.net


More information about the Digitalmars-d mailing list