The Expressive C++17 Coding Challenge in D

John Gabriele jgabriele at fastmail.fm
Wed Feb 14 17:13:28 UTC 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.

Great article! Thank you!

Typo: "and finally format bundles" --> "and finally std.format 
bundles".

Another typo: "In the latter article I will also present a 
solution which only uses 12 lines, but it uses the built-in 
std.csv module and I think D doesn’t even need to cheat." should 
probably instead start "Later in this article I'll also 
present..." or "Further down I'll also present".

But even then, I don't think you should discount or put off using 
std.csv as "cheating". I'm guessing std.csv handles things like 
quoted elements containing commas. I realize that maybe you're 
being pedagogic and wanting to show off D's File byLine and 
splitter, but I think the first thing a reader will think when 
they see you rolling your own csv reader by hand is that 
something must be wrong with D or it's ecosystem if you're 
resorting to this, and they'll run for the hills (especially in 
an intro article, *and* one in which you point out that the goal 
is *expressive* code).

In fact, I'd go so far as to say that, when searching online for 
how to read in a csv file for a given language (see many examples 
at <http://rosettacode.org/wiki/CSV_data_manipulation>), if the 
example involves splitting on commas, I immediately assume it's 
either old/incorrect, the language is very low-level only, or 
else maybe the language's std lib must be impoverished.



More information about the Digitalmars-d-announce mailing list