Why is D unpopular?

Walter Bright newshound2 at digitalmars.com
Mon May 2 01:42:19 UTC 2022


On 5/1/2022 1:39 PM, Max Samukha wrote:
> I don't quite understand why you insist on native code. Do compilers to bytecode 
> count? There used to be a language called Nemerle 
> (https://en.wikipedia.org/wiki/Nemerle), which had been mentioned on these 
> forums many times, long before D got CTFE. The earliest mention I found is 
> https://forum.dlang.org/post/ca56h1$2k4h$1@digitaldaemon.com. It had very 
> powerful macros, which could be used as compile time functions, AST macros, and 
> whatnot. The language is now dead because it was too good for humans.

Nemerle targeted C#'s bytecode system. I.e. it's an interpreter.

A language designed for interpretation does not distinguish between compile time 
and run time. While the program is executing, it can generate more code, which 
the interpreter executes. If the language is successful, it'll often get a 
native code generator to speed it up. The compiler is part of the runtime of the 
language.

A language designed for native compilation draws a hard distinction between 
compile time and run time. You'll see this in the grammar for the language, in 
the form of a constant-expression for compile time, and just expression for run 
time. The constant-expression does constant folding at compile time. The runtime 
does not include a compiler.

D is the first language I know of, designed for native compilation, with 
constant-expressions, that extended the evaluation of constant-expressions with 
the ability to execute functions at compile time. There's no compiler in the 
runtime. D does not support compiling code at runtime.

To clarify, if the runtime of a language includes a compiler, that is in the 
interpreted class of languages (even if they jit to native code), and it is not 
an example of what D's CTFE is doing. Lisp, Java, C# and apparently Nemerle fall 
into this category.

To show D is not the first, I request an example of a language designed for 
native compilation, that does not include a compiler in the runtime, that has 
constant-expressions in the grammar that must be computed at compile time and 
can execute ordinary functions at compile time.

C++ came closest to the mark with its Turing-complete templates.


More information about the Digitalmars-d mailing list