Herb Sutter briefly discusses D during interview

Jonathan M Davis jmdavisProg at gmx.com
Wed Jun 8 11:57:12 PDT 2011


On 2011-06-08 10:38, Ali Çehreli wrote:
> On 06/08/2011 01:49 AM, Jonathan M Davis wrote:
> > No, people don't normally look at declarations such as
> > 
> > int* a;
> > 
> > as being right to left. But from the compiler's perspective, they are.
> 
> I will go a little bit off topic here. If we need to think about what
> the compiler does or how a specific language feature is implemented,
> that language is a failed abstraction. D is not. There shouldn't be any
> need to get into implementation details to describe a language feature.

It's not really a matter of understanding how the compiler implements a 
specific feature so much as understanding type semantics. But yes, type 
declarations can be hard to read, and understanding fully does pretty much 
require understanding how the compiler looks at them.

It's like operotor associativity and precedence. You need to understand that

auto i = 7 + 12 * 2;

gives i a value of 31, not 38. Type declarations are the same. You need to 
understand how they're constructed. They're just a more complicated example 
and one which you can actually misunderstand on some level but generally 
understand well enough to program just fine. It's more complicated type 
declarations (such as C-style function pointers, const pointers in C/C++, and 
to some extent static array declarations in D) which tend to force you to have 
a better understanding of type declaration semantics. Complicated type 
declarations are complicated, and so deciphering them can be complicated.

- Jonathan M Davis


More information about the Digitalmars-d mailing list