I’m looking to understand why Java designers chose to implement function declarations this way. I’ve often heard it said that the designers of Java wanted to avoid poor design choices made in other languages (e.g., C++) — multiple inheritance via classes and operator overloading come to mind — in order to keep the object-oriented model as simple as possible and to encourage good programming practices. Is that true in this case? Is this feature too expensive to implement vis-a-vis the (admittedly marginal) gains it provides?
The thing is, I can’t see (and I’m still learning, so that probably means squat! :D) a significant implementation overhead in allowing the omission of formal parameter names in function declarations. And I can think of at least one example where this feature couldn’t hurt: defining abstract functions.
Anyway, glad to hear some thoughts from people on SO. BTW, the relevant section (8.4.1) of the Java Language Specification explains what but doesn’t talk about why.
EDIT: Adding a code snippet:
abstract void someFunc(int, int, int);
(I’m using an abstract function as this is one simple case I can think of where this feature would be handy).
You can drop formal arguments by using overloading e.g.
EDIT: From my comment.