Why is D unpopular?

Max Samukha maxsamukha at gmail.com
Tue May 3 07:29:24 UTC 2022


On Monday, 2 May 2022 at 20:30:36 UTC, Walter Bright wrote:
> On 5/2/2022 2:57 AM, Max Samukha wrote:
>> There is nothing big about CTFE. )
>
> It completely transformed how D code is written.
>
> Check out this, for example:
>
> https://github.com/dlang/dmd/blob/master/src/dmd/backend/oper.d#L388
>
> DMD used to do this initialization as a separate program, which 
> did what the lambda did here, and wrote out a file which was 
> then compiled in as part of DMD. The Digital Mars C++ did the 
> same thing for its tables.

I've been using D in-and-out since around 2006 and might be aware 
of every existing use case of CTFE. Lambdas work well for simple 
cases like the one you mentioned, but not so well for more 
involved ones:

alias format(A...) = (string format, A args...)
{
     string[] r;
     r ~= "bar";
     return r;
};

enum s = format("...", 1, 2);

1. Can't make it a normal function, because it needs to be usable 
with -betterC, and ~= prevents that.
3. Can't make it a lambda, because there's no way to express 
variadics for lambdas without loosing IFTI.





More information about the Digitalmars-d mailing list