Understanding Templates: why can't anybody do it?
Entity325
lonewolf325 at gmail.com
Sat Mar 17 17:00:56 PDT 2012
Wow, popular thread is popular.
Thanks for all the help, everyone. I haven't read all of it, but
I will take the time to sift through everything and see what I
can apply.
Response to some of what I did read:
-I didn't conclude that templates are confusing because they
confused me. I concluded templates are confusing because both of
the D language reference pages which talk about them have quotes
at the top talking about how confusing Templates are. Reflecting
on my (short!) experience trying to learn them, I merely
concluded that templates are confusing because nobody really
makes an effort to explain them cleanly. Now, the effort has
been made about 22 times(by my count) in this thread alone, so
that's a plus!
-While most of my programming professors had a decent idea of
what they were doing, the classes themselves left massive, gaping
holes in my education that I never even realized were there until
I got a job writing Java code. I don't even particularly LIKE
Java.
Could just be that I'm a slow learner.
I messed around with Templates after making that post and learned
that they seem to behave similar to Generic types in Java(I am
forever finding warnings that a generic type hasn't been type
specified in our code. Sometimes I fix it, sometimes I leave it
alone) I tried rewriting my structs to utilize templates(I
currently have separate versions for float and int types) but
that did little more than illustrate just how lost I was, so I
switched back. It should be possible in theory, the question is
the practice.
Study was further set back by the fact that I suddenly realized
none of my operator overloads are working... at all. It looks
like it checks with the language reference page, but I think it's
time to write another toy-sized learning program.
More information about the Digitalmars-d
mailing list