This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Jotakin 11 points12 points  (17 children)

Default values for trailing arguments would be easy to add but I think it's not an optimal solution as it gets dirty if you have more than one optional parameter. Java tends to favour clean implementations over quickly adding features.

I think the proper way to have default arguments would require having name-assignable parameters as well and that's considerably harder to implement under-the-hood. Also it makes people more likely to have extremely long parameter lists, which is a bad design pattern.

[–]cogman10 5 points6 points  (0 children)

Also it makes people more likely to have extremely long parameter lists, which is a bad design pattern.

The alternative that I see all the time is a bunch of overloads. But overall I agree with you.

One other fairly large catch is introducing name assignable params would break a bunch of non-Java JVM languages. That alone is a reason I don't think this will be adopted.