What is your favorite D feature?

via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 24 01:48:25 PDT 2017


On Friday, 23 June 2017 at 18:51:13 UTC, Anonymouse wrote:
> On Thursday, 22 June 2017 at 00:48:25 UTC, Seb wrote:
>> Hi,
>>
>> I am currently trying to modernize the D code example roulette 
>> on the dlang.org front page [1]. Hence, I would love to hear 
>> about your favorite feature(s) in D.
>> Ideas:
>> - favorite language construct
>> - favorite code sample
>> - "only possible in D"
>>
>> Before you ask, yes - I want to add a couple of cool examples 
>> to dlang.org (and yep the roulette rotation is currently 
>> broken [2]).
>>
>> [1] 
>> https://github.com/dlang/dlang.org/pulls?q=is%3Apr+is%3Aopen+label%3A%22Frontpage+example%22
>> [2] https://github.com/dlang/dlang.org/pull/1757
>
> Fairly specific, but foreach (member; someStruct.tupleof).
>
> Part of my work on my IRC bot has been to serialise structs 
> into configuration files (since std.json was *non-trivial* to 
> deal with), and foreaching a someStruct.tupleof or a 
> __traits(allMembers, symbol) allows for really, really 
> interesting stuff.

Agreed. I have proposed [0] a variation on one of Sebastian's 
examples that uses
that technique, so feel free to chime in with concrete 
suggestions there
or here on the forums.

[0]: 
https://github.com/dlang/dlang.org/pull/1762#issuecomment-310377649


More information about the Digitalmars-d mailing list