Why is D unpopular?

test123 test123 at gmail.com
Tue May 3 07:35:08 UTC 2022


On Tuesday, 3 May 2022 at 07:29:24 UTC, Max Samukha wrote:
> On Monday, 2 May 2022 at 20:30:36 UTC, Walter Bright wrote:
>> [...]
>
> 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.


You can use it with betterC if you put the format into a separate 
di file.



More information about the Digitalmars-d mailing list