Idiomatic D?

Dicebot public at dicebot.lv
Fri Jan 31 04:55:54 PST 2014


On Thursday, 30 January 2014 at 22:40:24 UTC, Tofu Ninja wrote:
>> There is no "official" idiomatic style like, for example, in 
>> python. When I speak about idiomatic D I usually think about 
>> style Phobos is written in (omitting legacy modules) as it is 
>> the code that gets most attention from most experienced D 
>> developers.
>
> Got any tips?

I'd say single most important thing is designing your API's to be 
range-based and making sure they work nicely with std.algorithm

Preferring simple template + procedural/functional solutions over 
complicated object hierarchies. Treat module as your basic design 
and incapsulation unit, not class.

Don't rely on specific types, prefer generic implmentations. 
Verify your all your assumptions with constraints and/or static 
asserts.

Use DDOC + documented unittest feature. It rocks.


More information about the Digitalmars-d-learn mailing list