D dropped in favour of C# for PSP emulator

Jonathan M Davis jmdavisProg at gmx.com
Fri May 11 14:53:01 PDT 2012


On Friday, May 11, 2012 20:38:41 Mehrdad wrote:
> On Friday, 11 May 2012 at 18:21:24 UTC, H. S. Teoh wrote:
> > Templates are stencils for generating code. There's nothing
> > confusing about that.
> 
> "Stencils for generating code"? _This_??! :O
> 
> template hasMember(T, string name)
> { enum hasMember = __traits(hasMember, T, name); }
> 
> 
> Imagine a new user's confusion when seeing something like this.
> (Not sure I got it exactly right, but my point is there.)

Templates are a code-generation tool. They're "templates" for code. I really 
think that the majority of programmers don't quite get that, even when they've 
programmed in C++ quite a bit. Templates are frequently used for stuff like 
making it so that you can construct a container with a different element type 
than another container of the same type or letting functions take a variety of 
argument types. Actually actively trying to _generate_ code with them is 
getting into template metaprogramming land, which is very ugly in C++ and 
therefore very foreign to many (most?) programmers. D makes it _much_ easier 
and _much_ more sane, so we end up doing it all the time, and it's definitely 
something that many programmers coming to D are going to have to learn as 
opposed to it being completely intuitive. Much of it really isn't all that 
complicated or difficult IMHO, but it's definitely new and different for many 
programmers.

- Jonathan M Davis


More information about the Digitalmars-d mailing list