Indexer support
Syntactic sugar for array index acces, instead of
ar.get(0)sayar[0], and instead ofar.set(0, val)sayar[0] = val;Indexers are now syntactic sugar for
.getand.setcalls, respectively. That means:var ar = [1, 2, 3]; ar.set(0, 1); // is equivalent to: ar[0] = 1; // and log(ar.get(0)); // is equivalent to: log(ar[0]); But this also works with the Map type: var dat = Map<String, Object>(); dat["name"] = "Zef Hemel"; dat["age"] = 27;Naturally, this also works for custom types.
Submitted by Zef Hemel on 11 April 2011 at 11:01