What if a Java allow both static and dynamic types. That might allow the best of both worlds. i.e.:
String str = "Hello";
var temp = str;
temp = 10;
temp = temp * 5;
- Would that be possible?
- Would that be beneficial?
- Do any languages currently support both and how well does it work out?
Here is a better example (generics can't be used but the program does know the type):
var username = HttpServletRequest.getSession().getAttribute("username");//Returns a String
if(username.length() == 0) {
//Error
}