December 10, 2019
On Tuesday, 10 December 2019 at 02:46:58 UTC, norm wrote:
> ---
> new_range  = [i * i for i in range(5)   if i % 2 == 0]
> ---
> import std.range;
> auto new_range = iota(5)
>                  .filter!(i => i % 2)
>                  .map!(i => i * i);
>
> These produce different results, is that intended? I think the filter should be
>
> `filter!(i => i % 2 == 0)`
>
> For your use case it makes no difference if you map first or filter first. It might be useful to show a case where it does matter to highlight how the UFCS allows D to give a more natural order of the chained operations.
>
> Cheers,
> Norm

Done, using addition and adding the missing equality

December 11, 2019
On Thursday, 5 December 2019 at 22:28:53 UTC, Adam D. Ruppe wrote:
> On Thursday, 5 December 2019 at 22:21:13 UTC, Walter Bright wrote:
>> D being about a third less code than C++ is consistent with my unscientific experience with it.
>
> Indeed, I actually frequently do even less. A lot of repetition in other languages I find myself able to automate pretty well in D. Whole blocks of 1,000 lines of glue code in other languages can be replaced with 30 lines of CT reflection stuff.

This is something that D excels at. That is why I like it. Many external
world communication can be done efficiently.

About a third of the code. There are still things in C++20 that cannot be
done, but modules will allow to use using directives more liberally and they
remove the implicit inline from classes. This means that code will get
quite shorter I think. C++20 has a lot of baggage but still stays as a very
competent language IMHO.
1 2 3
Next ›   Last »