February 14, 2018
On Wednesday, 14 February 2018 at 06:42:23 UTC, Arun Chandrasekaran wrote:
> It takes a lot of time and effort to write such quality content. Thanks for detailed explanations.

Thanks :)
Now if we had a magic automaton that makes more of these ...

> // import std.algorithm, std.exception, std.format, std.range, std.stdio;
> Do you think it is worth mentioning about std.experimental.scripting in section 2?

Well, it hasn't been released yet, but maybe I get around writing another article ;-)
Also looking at the C++ "competitor", I think we aren't too bad off with a few modules for now:

---
#include <algorithm>
#include <experimental/filesystem>
#include <fstream>
#include <iostream>
#include <optional>
#include <string>
#include <string_view>
#include <sstream>
#include <utility>
#include <vector>

using namespace std;
namespace fs = std::experimental::filesystem;
---

> Syntax highlighting is missing in some snippets.

Thanks for the pointer. Fixed!
February 14, 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:
> Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much:
>
> https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d
>
> It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.

Nice work!  I was recently asked by my employer "why D?".  I think I need to show them this.

>> Aren’t you concered that Rust is faster in this benchmark?

> Not at all. The challenge was to write expressive code and if performance really matters I can always opt to optimize the hot path of the program and don’t need to pay a > 4x code duplication cost upfront.

You've gotta address this, IMO.  What's the performance/expressiveness tradeoff like in D?

Mike
February 14, 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:
> Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much:
>
> https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d
>
> It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.

Nice! Good overview of many of the good things in D.

Nitpicks:

> I used the following rdmd script to generate a simple CSV file with 10 fields and 10m lines:
> 
> rdmd --eval='10.iota.map!(a=> "field".text(a)).join(",")
> .repeat(10_00_000).joiner("\n").writeln' > input_big.csv

10_00_000 should probably be 10_000_000.


> They are only view on the actual memory and you don’t copy the array, but just the view on (in D it’s called a slice).

Missing some words here: "only *a* view". "but just the view on" seems to be missing the second half of the sentence.


There's also a few typos: 'vauge' should be 'vague', 'it providers' should be 'it provides', 'shot yourself in the feet' should probably be 'shoot yourself in the foot'

Thanks for writing all this - it's a great intro to the language.

--
  Sien
February 14, 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:
> Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much:
>
> https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d
>
> It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.

Sadly, he just picked the solution that used most C++17 features and not one that was clean and compact... :-/

I guess the point was to create a C++17 tutorial, and not a coding contest as such.






February 14, 2018
14.02.2018 11:45, Ola Fosheim Grøstad пишет:
> On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:
>> Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much:
>>
>> https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d
>>
>> It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.
> 
> Sadly, he just picked the solution that used most C++17 features and not one that was clean and compact... :-/
> 
> I guess the point was to create a C++17 tutorial, and not a coding contest as such.

It's sadly that using most C++17 features fails to provide clean and compact solution...

February 14, 2018
On Wednesday, 14 February 2018 at 08:53:31 UTC, drug wrote:
> It's sadly that using most C++17 features fails to provide clean and compact solution...

I don't usually use iostream, but this "challenge" was a reasonable fit for it. If you look over the 4 submissions then the iostream one provides the best encapsulation of the problem:

http://coliru.stacked-crooked.com/a/4675a74c8124750f

C++ blogposts tend to choke on features... usually not good examples of maintainable code.

February 14, 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:
> Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much:
>
> https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d
>
> It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.

Down in the 'Other cool D features' you have:


* Inline documentation
* Contracts
...
* Built-in documentation
* Contracts and invariants


Nice read!
February 14, 2018
On Wednesday, 14 February 2018 at 08:53:31 UTC, drug wrote:
> 14.02.2018 11:45, Ola Fosheim Grøstad пишет:
>> On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:
>>> Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much:
>>>
>>> https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d
>>>
>>> It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.
>> 
>> Sadly, he just picked the solution that used most C++17 features and not one that was clean and compact... :-/
>> 
>> I guess the point was to create a C++17 tutorial, and not a coding contest as such.
>
> It's sadly that using most C++17 features fails to provide clean and compact solution...

yeah.. even the more modern C++ code still makes me want to stay clear of it...(perhaps even more so).

I just never get the same feeling when I look at D programs.

February 14, 2018
Seb,

I believe this blog post would make a great article for Overload or CVu.

On Tue, 2018-02-13 at 23:35 +0000, Seb via Digitalmars-d-announce wrote:
> Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much:
> 
> https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-i n-d
> 
> It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.
-- 
Russel.
===========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk


February 14, 2018
On Tuesday, 13 February 2018 at 23:35:36 UTC, Seb wrote:
> Someone revived the Expressive C++17 Coding Challenge thread today and I thought this is an excellent opportunity to revive my blog and finally write an article showing why I like D so much:
>
> https://seb.wilzba.ch/b/2018/02/the-expressive-c17-coding-challenge-in-d
>
> It's mostly targeted at beginners as I explain many basic D features, but maybe it's helpful for beginners looking into D.

Very nice read!!! Thank you!


One "typo?" Chapter 8)

>same format function that would normally be called at compile-time
 s/compile/run/

It would be good to say a little more about the '!' ct-parameter

At fist when reading D code coming from ruby (after, php,...C++,C, Pascal...),
I thought, that the ! is like in Ruby just an way to distinguish between a function modifying the contend or not (compare gsub to gsub!) it took sometime before this important bit came clear to me.
So just something, like functions in D may have two parameter brackets:
One for compile-time and one for run-time parameters:
fun!(ctParam)(rtParam) ... short fun!(cParam)() ... fun!ctparam

Other point:

Showing some more alternative D solutions for the same problem, might be a little contest in this thread, just post your shorter and better solutions :-)