Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I get your point, however Java came after C++, its usage of "new" is however more consistant IMO. In that regard I don't see what either language designers could have done. This post, if I understand it correctly, was a plea to language designers.


The usage of "new" in Java is consistent according to the rules of Java and the usage of "new" in C++ is consistent according to the rules in C++. I don't think you can say that one is more consistent than the other. To a C++ programmer, the usage of "new" in Java, on first blush, seems highly inconsistent. Why use it for a String but not an int for example? The answer, of course, is that Strings in Java are objects and ints aren't. In C++, everything is an object.

"new" simply has a different meaning in Java even though the syntax is similar. If I were designing Java, I'd leave out the "new" keyword altogether. I see it as unnecessary to the semantics and confusing to C++ programmers, but that's just me. =)

I agree that the post was a plea to language designers, but such a plea is probably pretty useless and I didn't find it worth discussing. However, it can be fun to relate to his frustrations by sharing a story from your own experience.

Are you a Java developer? What's the most annoying behavior you see coming from converted C++ developers?


In C++ everything is an object? Since when? Or are you only calling the added "++" components "C++" but not the included C syntax?

As for me, I don't call myself a [insert language]-developer. I use whatever language suits best to design software. So far I have experience in many common procedural, OO and markup languages (C,C++,Java,Obj C,CUDA C,bash,python,VB,Matlab,Lotusscript,html+css) and I try to get experience in functional languages as soon as I can get some time for that. What's characteristic for me in Java is mainly its VM architecture. This makes it useful when you need the flexibility of a 3rd generation language for easily portable code (e.g. many business applications), however it has some disadvantages that have hindered its success for consumer applications. The main disadvantages IMO are the non-native feel of the GUI, maintenance and compatibility problems of the Java VM and Oracle's business strategy as of late. Java's syntax is just fine, I don't have any grudges about it. Knowing Obj C well, I know what ugly syntax looks like, however I still like that language as well (performance and frameworks are quite good, especially compared to other mobile frameworks).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: