Stewart Stremler wrote: > begin quoting Christopher Smith as of Tue, May 23, 2006 at 09:33:32AM -0700: > [snip] > >>Java lacks from that list: >>1) overloaded operators > > Thank god!
You know, I used to be of the same mind, but I'm increasingly realizing that not having this really gets in the way of code reuse. You end up with a lot of redundant code that becomes a pain to maintain. Sometimes it's worth it for the clarity of the code. >>2) access to platform specific features (yes, you can use JNI but at >>that point you aren't using Java) > > It's analagous to using ASM fragments in a C program. Since Java was > meant to be as platform-agnostic as possible, this is not a concern. > So yes, Java doesn't have it, but that was desgined in as a feature. Language design is a series of trade offs. I wasn't trying to suggest that all languages should have these features, merely that there were some unique benefits from having this combination of features. I guess ASM fragments in a C program is a somewhat appropriate metaphor. I think the difference is that C++ makes it trivial to access C libraries, which is really quite helpful. >>3) destructors, and lexically scoped resource management in general > > Yup. It's tricky, error-prone, and thus designed out. Resource management is always tricky. By not having this feature, Java makes it impossible to encapsulate resource management, so now instead of having to get it right in one place you have to get it right every place you use a resource. C#'s approach to this problem seems like a more reasonable compromise, but ultimately you are still vulnerable to all the weird stuff that comes with finalization. >>4) multiple inheritence > > Thank god! I'd be inclined to agree with you if Java had provided another mechanism for doing things like mixins (like Objective-C's delegates for example). Sadly Java did not. >>5) fairly well defined performance costs > It trades that for improved programmer performance and reduced > programmer headaches. :) The two are not mutually exclusive. >>On top of that, it's support for generic programming is limited enough >>that it's hard to use it effectively outside the context of collections. > > Losing multiple inheritance and using interfaces took care of (from my > point of view) ~90% of the problems addressed by templates/generics. I > frankly don't miss 'em very much. I think you have a pretty limited appreciating for generics then. Try implementing something as simple as a type-safe generic singleton in Java. Type erasure, particularly it's impact on classes and serialization, is a very severe limitation. > Other people did, thus the whole "generics" thing to introduce the > ugly C++-style syntax for templates. I figured an ability to overload > return types (polymorphic return types? I forget the term) was sufficient. > (But then Java would have the same problem as C++ templates: bloat.) Take a look at what C# did for it's generics. It's possible to do the right thing without Java's brokenness. You just need to change your runtime, which the Java folks weren't willing to do (for perfectly good reasons). >>So no, I didn't describe Java. > Correct. :) I think you've misunderstood what I was saying. I wasn't saying that Java was a horrible language because it lacked these features. I was merely pointing out that Paul's claim that Java had these features was patently ridiculous. --Chris -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg
