Why are homepage examples too complicated?

Guillaume Piolat via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 13 15:12:42 PDT 2016


On Thursday, 13 October 2016 at 19:06:26 UTC, Karabuta wrote:
> I assume the purpose for those demonstrations are to win the 
> interest of the user as to how easy and clean D code can be. 
> Then why;
>
> // Round floating point numbers
> import std.algorithm, std.conv, std.functional,
>     std.math, std.regex, std.stdio;
>
> alias round = pipe!(to!real, std.math.round, to!string);
> static reFloatingPoint = ctRegex!`[0-9]+\.[0-9]+`;
>
> void main()
> {
>     // Replace anything that looks like a real
>     // number with the rounded equivalent.
>     stdin
>         .byLine
>         .map!(l => l.replaceAll!(c => c.hit.round)
>                                 (reFloatingPoint))
>         .each!writeln;
> }
>
> How is a new visitor supposed to know "!" is for templates and 
> not some complicated syntax?

I agree, something friendly and familiar would be called for. 
Instead we have weird float-rounding programs.

The goal of such program should be to push the reader to continue 
reading by apealing to familiarty. I think this strongly conveys 
the message that D is complicated and "not for me".

See also:
https://golang.org/
https://www.rust-lang.org/fr-FR/
https://crystal-lang.org/
https://www.ruby-lang.org/fr/
https://www.python.org/

Do you notice something? The language branded as "simple" have 
the simplest landing page programs.


More information about the Digitalmars-d mailing list