Origins of the D Programming Language

Neia Neutuladh neia at ikeran.org
Fri Nov 30 22:03:21 UTC 2018


On Fri, 30 Nov 2018 14:34:58 -0500, Andrei Alexandrescu wrote:
> We'd appreciate feedback and additional historical details.

The structure of the document doesn't reflect history. It also doesn't 
reflect the uniqueness of the described features; conditional compilation 
was present in C since time out of mind, for instance, and it's relatively 
high on the list.

Is there any logic to the order?

Line 658:
> mixin would just be an arcane way to write code, were it not for CTFE.

In point of fact, mixin predates CTFE. Templates could assemble strings at 
compile time. I used that technique in a couple ancient projects.

Line 698:
> In D, a user-defined attribute is a value of any type, as long as it is
> known during compilation.

Currently, a UDA is an *expression* that does not need to have a type. You 
can use a package or a module as a UDA. People commonly use a raw type as 
a UDA.

There is also a bug that lets you use non-compile-time-constants as UDAs 
as long as you insert a pragma(msg) in the right place, but that's 
probably not something you want to advertise in this document.

Line 708:
> To add one or more attributes to a declaration, the programmer uses the
> following syntax

The syntax demonstrated:

    @("Smith", 1.2, "2018-08-31") int myFunction(int x);

The implication I got from the text was that that was the only way to 
attach multiple annotations to a declaration. However, Java-style also 
works:

    @("Smith") @(1.2) @("2018-08-31") int myFunction(int x);


More information about the Digitalmars-d mailing list