I think that macros can sometimes be used to come to the same end. I understand that they are not the same.
[quote]I personally prefer not to have the language dumbed-down to the level of VB. Reflection is a difficult (well I don’t think so, but others do) part of the Java language too
[/quote]
I agree. Reflection is great, and dumbing down a language is (usually) a bummer. That said, I don’t mind much that Java doesn’t have multiple inheritance or operator overloading… I think C++ is really pushing it on the operator overloading for instance >>, << for stream I/O and shifting seemed to be a bit of a stretch, but I admit I’ve gotten used to it.
[quote]No. Have you heard of concepts before? They are the C++ template equivalent of a Java interface.
[/quote]
I know what you are talking about, but I’m not that familiar with using the term ‘concepts’ in that context. I always considered using an abstract base class as an ‘interface’ to be a more direct equivalent to java’s ‘interface’.
[quote]For example, the sort function defines the values of the iterator parameters to implement the LessThanComparable concept, which, roughly speaking, means that they must be able to compare to each other using the “<” operator.
[/quote]
But the “<” operator is really nothing more than the Java compareTo method… At least the difference is insignificant in the same way that ‘java generics are just a fancy way to cast’. So I’m missing the point… I just don’t see how ‘concepts’ are fundamentally different. They both appear to allow for generic programming… at least to some degree. I mean, how is not writing an operator< any different from not implmenting the comparable interface? I believe you when you say ‘concepts are more powerful’, but what is not clear is “How much? and Why?”
[quote]Java generics don’t enable anything whatsoever besides casting. That doesn’t help anybody implement generic algorithms or containers in any fashion. Hopefully you’re starting to see some of the differences here.
[/quote]
I’m afraid I’m not yet seeing the differences, as I think generics do help, BY elminating the casting. Just as any high level language helps by allowing me to not write everything in machine code. That’s ultimately all any language feature is doing for you, be it ‘concepts’, generics, templates, whatever…
[quote]Programs that use templates this way have been around for at least over five years. That’s over half of Java’s entire lifetime.
[/quote]
That wasn’t the point… programs that use templates for anything more than saving you what you could get with some tedious cut and paste have been, in my experience, hard to come by. I just don’t see functional languages being used much. Lisp has been around for ages, and I only know of one program in wide spread use (Emacs) that has anything to do with it. I’ve heard of Haskell, I think I read a bit about it, and came to the same conclusion… it hasn’t caught on, sure it is used, but for much less than 1% of the software development going on in the world. (another assuption, I know)
[quote]Perhaps you don’t keep up with C++ as much as you used to? For example, how many C++ journals do you read compared to Java journals? How many C++ newsgroups do you read as compared to Java newsgroups? It’s easy to fall behind.
[/quote]
Very true, I don’t keep up as much as I would like… that’s sort of what I’m trying to do here - I figure I learn it faster if you shove it down my throat :). I’m just at the stage where I am trying to get used to proper use of C++ templates and Smart pointers and C++ resouce management in the face of C++ exceptions… they are all areas that I know I need to develope in. This thread is helping to open some other possiblities… I wish I had more time to practice this stuff… as I fear I have already fallen too far behind. I tried to get things moving in that direction at my last workplace, but the rest of the team were happy with something only slightly beyond C++ as a better C… our object oriented design was lacking… i got violent protests from the use of C++ templates… mainly because the tools made them so hard to debug! (Try setting a break point in a specific instantiation of a template… ugh!)
BTW… Thanks for Jace… I now remember checking it out quite awhile ago, and you reminding me of it here made me take another look… I just may have a good opportunity to use it in my next project. It looks quite cool.
Scott