Is D’s grammar really context-free?

Being context free is first a property of generative grammars. It means that what a non-terminal can generate will not depend on the context in which the non-terminal appears (in non context-free generative grammar, the very notion of “string generated by a given non-terminal” is in general difficult to define). This doesn’t prevent the same … Read more

Metaprogramming in C++ and in D

The two biggest things that help template metaprogramming in D are template constraints and static if – both of which C++ could theoretically add and which would benefit it greatly. Template constraints allow you to put a condition on a template that must be true for the template to be able to be instantiated. For … Read more

To GC or Not To GC

To directly answer your two questions: Yes, creating class instances by reference does result in a lot of heap activity, but: a. In D, you have struct as well as class. A struct has value semantics and can do everything a class can, except polymorphism. b. Polymorphism and value semantics have never worked well together … Read more

Why 0.1 + 0.2 == 0.3 in D?

(Flynn’s answer is the correct answer. This one addresses the problem more generally.) You seem to be assuming, OP, that the floating-point inaccuracy in your code is deterministic and predictably wrong (in a way, your approach is the polar opposite of that of people who don’t understand floating point yet). Although (as Ben points out) … Read more

How fast is D compared to C++?

To enable all optimizations and disable all safety checks, compile your D program with the following DMD flags: -O -inline -release -noboundscheck EDIT: I’ve tried your programs with g++, dmd and gdc. dmd does lag behind, but gdc achieves performance very close to g++. The commandline I used was gdmd -O -release -inline (gdmd is … Read more

D Programming Language in the real world? [closed]

I do bioinformatics work in D. For me, the key thing about D is that it takes a very level-headed approach to tradeoffs and recognizes the principle of diminishing returns. Unlike C++, which adheres rigorously to the zero-overhead principle, D allows features that may have a small performance/space cost if they make the language a … Read more

Is D a credible alternative to Java and C++? [closed]

What determines the success and popularity of a programming language for real-world software development is only partially related to the quality of the language itself. As a pure language, D arguably has many advantages over C++ and Java. At the very least it is a credible alternative as a pure language, all other things being … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)