Redesign of dlang.org

anonymous via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 7 15:27:47 PST 2016


On 07.01.2016 12:36, Bastiaan Veelo wrote:
> Understand. But IMO the main objective should be to demonstrate
> expressiveness and productivity to newcomers, and therefore it is
> crucial that the examples are understandable in its entirety by every
> newbie. Someone unfamiliar to D's UFCS and template instantiation syntax
> are likely unable to parse these examples in their heads without
> explanatory comments. Without the comments this example reduces to an
> incomprehensible blob of code without structure (in the eyes of a
> first-time visitor, who may not have a degree in CS) and is likely to
> repel instead of attract.

I don't agree that examples need to be fully understandable to newbies. 
We'd have to explain every single line. Rather, I think the examples 
should answer the question "How familiar or outlandish will D be for me?"

That said, I'm not against comments, and I may have gone overboard when 
cutting that example down. But I still think it's too long with all 
comments intact.

> This looks pretty frightening if the objective
> is just to round floating point numbers (as explained by the only
> remaining comment) -- of course we know that this does a lot more, but a
> newbie doesn't.

Maybe the example should focus on command line arguments instead of 
stdin. No "replace anything that looks like a number", which is hard to 
match properly anyway, but instead just assume numbers in args. No regex 
necessary, just a `.map!(arg => arg.to!real.round.to!string)`.

Unfortunately, it looks like the handling of command line args is broken 
on dpaste: https://issues.dlang.org/show_bug.cgi?id=15050

> A competition for writing the most concise code does not necessarily
> produce the most illustrative introductions into a language.

It's not a competition to write the shortest, but a competition to come 
up with something that's short enough. While being short it should 
actually be properly formatted, idiomatic D code.


More information about the Digitalmars-d mailing list