A Perspective on D from game industry
H. S. Teoh via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 17 11:22:46 PDT 2014
On Tue, Jun 17, 2014 at 06:08:57PM +0000, via Digitalmars-d wrote:
> On Tuesday, 17 June 2014 at 17:19:25 UTC, H. S. Teoh via
> Digitalmars-d wrote:
[...]
> >There's no need to get rid of string mixins just because of that 1%
> >of code that actually needs to use them. Nobody says that the
> >transformation must work on 100% of all D programs, otherwise we
> >can't have it at all.
>
> The language should guarantee that you can detect deprecated
> features with 100% certainty. Otherwise you risk distributing
> template-libraries that don't work for certain configurations.
Unfortunately, CTFE makes this task impossible. Consider this:
int ctfeFunc() {
if (solveHaltingProblem()) {
useDeprecatedFeature();
} else {
useNonDeprecatedFeature();
}
}
enum x = ctfeFunc();
How would the compiler (or any tool!) detect the use (or non-use) of
deprecated features here?
> If you want to reduce the deployed code size you might want to
> translate code into something that can be transferred fast to
> web-browsers. That means you have to be able to translate 100%.
If you want it to run in a browser, and the browser doesn't support
certain language features, then you'll just have to restrict your code
to the subset of the language that's implementable in a browser, no?
> Of course, it is possible to avoid string mixins, but the same holds
> for #define(x…) in CPP.
I think that's gross exaggeration. #define is ubiquitous in C/C++: you
can hardly find any non-trivial program that depends on it, because the
language doesn't provide a way to express certain things otherwise. In
D, however, we have version, static if, and a whole bunch of other
niceties that makes string mixins unnecessary in 99% of cases. String
mixins are MUCH easier to avoid in D, than #define's are in C/C++.
T
--
Notwithstanding the eloquent discontent that you have just respectfully
expressed at length against my verbal capabilities, I am afraid that I
must unfortunately bring it to your attention that I am, in fact, NOT
verbose.
More information about the Digitalmars-d
mailing list