Why is D unpopular, redux.
mw
mingwu at gmail.com
Sat May 28 21:50:20 UTC 2022
On Saturday, 28 May 2022 at 19:30:42 UTC, Ola Fosheim Grøstad
wrote:
> On Saturday, 28 May 2022 at 18:15:10 UTC, Ola Fosheim Grøstad
> wrote:
>> On Saturday, 28 May 2022 at 17:32:04 UTC, IGotD- wrote:
>>> Folding in C++ is perhaps "powerful" but at the same time
>>> unreadable.
>>
>> I find it to be quite limited, but also confusing for the
>> reader:
>
> Two nested folds (nested loops):
>
>
> ```
> template<int... as, int... bs>
> void f(std::integer_sequence<int, as...>
> _1,std::integer_sequence<int, bs...> _2) {
>
> std::cout << ([](auto x){ return ((bs+x) * ...);}(as) +
> ...) << std::endl;
>
> }
>
>
> int main()
> {
> f(std::integer_sequence<int,1,2,4>{},
> std::integer_sequence<int,1,-1>{});
> return 0;
> }
> ```
>
> How many seconds do you need to understand what goes on?
>
> (Maybe it would be better to just implement Lisp.)
Wow, haven't looked at C++ for decades, it has advanced this far?
Truely marvelous ;-) a vivid testimony of Greenspun's tenth rule:
Any sufficiently complicated C or Fortran program contains an ad
hoc, informally-specified, bug-ridden, slow implementation of
half of Common Lisp.
(just plug in C++ here :-)
https://en.m.wikipedia.org/wiki/Greenspun%27s_tenth_rule
More information about the Digitalmars-d
mailing list