What are the prominent downsides of the D programming language?

FeepingCreature feepingcreature at gmail.com
Tue Sep 29 11:35:02 UTC 2020


On Tuesday, 29 September 2020 at 11:10:42 UTC, ddcovery wrote:
> * The "auto" Swiss knife:  Yes, I know, "auto" is a powerful 
> tool, but DLang libraries tends to force you to use auto 
> because metaprogramming... it is really difficult to a 
> newcomers to understand the Type returned by a template... and 
> templates are everywhere.
>
> i.e.:  If you read about Tasks 
> (https://dlang.org/phobos/std_parallelism.html), for me is not 
> obvious how to define an empty array of tasks.
>
> Imagine I have a "4 in a line" game and I want to evaluate with 
> a thread each column of the game (a minimax algorithm)
>
>> ??? tasks = [];
>> for( int ixTask=0; ix<COLUMNS; ixTask++){
>>   tasks ~= task!evalColumn(board.clone(), columns[ixTask], 
>> maxRecursion - 1);
>>   tasks[ixTask].executeInNewThread();
>> }
>> ...
>
> What do you have to place instead "???"

I mean, you could do this:

auto tasks = COLUMNS.iota.map!(ixTask => 
task!evalColumn(board.clone(), columns[ixTask], maxRecursion - 
1)).array;
tasks.each!"a.executeInNewThread";


More information about the Digitalmars-d mailing list