D dropped in favour of C# for PSP emulator
SomeDude
lovelydear at mailmetrash.com
Fri May 11 15:03:22 PDT 2012
On Friday, 11 May 2012 at 19:02:53 UTC, Mehrdad wrote:
> On Friday, 11 May 2012 at 18:53:57 UTC, H. S. Teoh wrote:
>> On Fri, May 11, 2012 at 08:38:41PM +0200, 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.)
>>
>> Yes, that's exactly how stencils work. You're essentially
>> generating a declaration of the form:
>>
>> enum hasMember = ...;
>>
>> <snip>
>
>
> That's not how you see it when you're learning though.
>
> It's more like, I can imagine someone asking these:
>
> 1. Why the heck do I see "hasMember" twice?
> 2. What does this have to do with enums?
> 3. Where is anything getting "returned"???
> 4. So you mean templates are THINGS?? I thought you needed a
> template SOMETHING, like a template struct, template function,
> etc...
> 5. What the heck is TypeTuple!()? Where's the blueprint?
>
>
> etc.
BTW, don't forget to have a look at the articles on the left:
http://dlang.org/tuple.html
More information about the Digitalmars-d
mailing list