Why is D unpopular, redux.

user1234 user1234 at 12.de
Fri May 27 14:46:47 UTC 2022


On Friday, 27 May 2022 at 11:00:20 UTC, zjh wrote:
> On Friday, 27 May 2022 at 10:51:58 UTC, user1234 wrote:
>
>> I think c++ needed this because it does not have a no-scope 
>> (static) foreach.
>> On the other side our unscoped foreach implementation is known 
>> to have limits.
>
>
> This is not 'static foreach', it is folding expr. If you've 
> written it, you know it's very cool.
>
> ```cpp
> template<class...T>int f(char c,T&&...t){
>     return b(c,t...)+c;
> }
> ```

yes you're right when you suggest that I've never used it.

My point was actually more on the fact that "..." solves the fact 
that c++
foreach does not work on tuples, i.e aggregates made of different 
types, while D has static foreach, which can be similarly used 
let's say to unroll += on each member of a tuple.


More information about the Digitalmars-d mailing list