January 31, 2014 Re: Idiomatic D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matt Soucy | On Friday, 31 January 2014 at 04:53:48 UTC, Matt Soucy wrote:
>>>>> Ranges, templates and structs.
>>>>
>>>> ~= CTFE ~ UFCS
>>>
>>> ~= std.algorithm ~ std.range
>>
>> ~= immutable ~ (isProperlyImplemented!shared ? shared :
>> repeatedlyAskAndreiWhatsGoingOnWith!shared
>
> );
>
> // Sorry but that was going to cause a slight error.
I knew I forgot something...
|
January 31, 2014 Re: Idiomatic D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tofu Ninja | On Thursday, 30 January 2014 at 22:40:24 UTC, Tofu Ninja wrote: > On Thursday, 30 January 2014 at 20:10:01 UTC, Dicebot wrote: >> On Thursday, 30 January 2014 at 20:05:11 UTC, Tofu Ninja wrote: >>> I hear it thrown around a lot but what does it actually mean? What does the ideal D code look like? What kind of things should some one think about if they are trying to do idiomatic D? >> >> 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? http://qznc.github.io/d-tut/idiomatic.html |
January 31, 2014 Re: Idiomatic D? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tofu Ninja | 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.
|
Copyright © 1999-2021 by the D Language Foundation