Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
Name: rmT116609 Date: 06/12/2003 A DESCRIPTION OF THE REQUEST : It would be really nice to provide special syntax for methods of certain core interfaces: 1) Variable x declared to be an instance of a class implementing java.util.List, x[i] could be compiled as x.get(i) and x[i] = y could compiled as x.set(i, y) 2) Variable x declared to be an instance of a class implementing java.util.Map, x{k} could be compiled as x.get(k) and x{k} = y could be compiled as x.put(k, y) 3) For x and y that are instances of classes implementing an interface (yet to be specified, maybe java.lang.Number) that defines arithmetic operations as add, subtract, multiply, lessThan etc. x + y is compiled as x.add(y) x - y is compiled as x.subtract(y) x * y is compiled as x.multiply(y) ... x < y is compiled as x.lessThan(y) etc. JUSTIFICATION : These are patterns that appear in code again and again, so it's worth providing syntax for making code more concise and make the intention of the code clearer. (Review ID: 187748) ======================================================================
|