What features of D are you using now which you thought you'd never goint to use?

DLearner mg_yin at yahoo.com
Sat Jun 22 10:35:30 PDT 2013


Hi H. S. Teoh, I noticed that when you replied to a post, your
reply usually started a new thread instead of showing in the 
thread the original post belongs to, this makes readers difficult 
follow original discussions.

On Saturday, 22 June 2013 at 16:42:24 UTC, H. S. Teoh wrote:
> On Sat, Jun 22, 2013 at 06:17:41PM +0200, Andrej Mitrovic wrote:
>> I remember just a few years ago I was avoiding learning to use
>> templates, thinking they're super-complicated and that I'd 
>> **never**
>> actually need them. I used to read about them in the pages of 
>> the
>> language reference, but nothing actually *clicked* while 
>> reading those
>> pages.
>
> Funny, templates were one of the main reasons I came to D. C++ 
> templates
> were (and still are) just so ugly and painful to work with.
>
>
>> I also remember reading about the `is()` keyword which was the
>> most intriguing but complex thing on the whole website that I 
>> just
>> couldn't wrap my head around.
>
> Yeah that one made my eyes glaze over. I still have trouble 
> wrapping my
> brain around the strange syntax of is(), and why its diverse 
> uses have
> been shoehorned into deceptively similar syntax.
>
>
> [...]
>> I wonder if newbies still get a little scared when they reach 
>> the
>> template section on dlang, and if we can improve this somehow. 
>> There
>> *are* tutorials out there, but dlang.org is probably where the 
>> user
>> gets his first impression of the language, and it has to be an
>> inviting one.
>
> I like the way Andrei presented templates in TDPL: he just 
> started using
> them without saying what they are, other than that the function 
> takes
> "compile-time parameters". By the time you get to the chapter on
> templates, you've already been using them for a while, so it's 
> not very
> scary anymore.
>
>
>> Anyway, what features are you using now that you thought you'd 
>> never
>> use when you started out using D?
>
> 1) Unittests. :) "Who needs unittests", I told myself, "when I'm
> obviously smart enough to write code once and have it work the 
> first
> time?" But they just kept staring at me going "hey we're right 
> here, use
> us!" until I was shamed into actually writing a few of them. 
> And then I
> discovered that I *wasn't* the genius programmer I thought I 
> was, and
> that my code was actually full of bugs, typos, and all sorts of 
> other
> problems that only show up in corner cases that, of course, I'd 
> failed
> to test by hand the first time round.
>
> 2) Ddoc comments. I'm still not fully sold on ddoc, but I've 
> actually
> started using it for my personal code libraries, and it's 
> actually quite
> nice. I don't have to install DOxygen and add a whole bunch of
> language-external stuff to my projects to actually use ddoc -- 
> another
> big advantage conferred by having them built into the compiler. 
> The
> default ddoc macros leave a lot to be desired, but I cooked up 
> a simple
> set of customized macros to make the output more palatable, and 
> ddoc is
> actually pleasant to work with now:
>
> <shameless plug>
> https://github.com/quickfur/Viola-ddoc-macros
> </shameless plug>
>
>
> T


More information about the Digitalmars-d mailing list