I posted a bunch of small features to get Lists into a nice usable state:
I added support for closures outside the call's parens for Ruby style:
list.each( |Obj v| { echo(v) } ) // old way list.each |Obj v| { echo(v) } // preferred way
I added support for generic parameterized closure signatures, so that type checking will occur on your closures:
list := [ "a", "b", "c" ] // infered Str[] list.each |Str s| { } // will compile ok list.each |Int s| {} // compile time error
I fixed list type inference to ignore nulls:
["a", "b", null].type == Str[].type
I added support for the common item management methods including [] shortcut support for get/set:
V get(Int index) L set(Int index, V item) L add(V item) L insert(Int index, V item) V remove(Int index) Void clear()
I decided to make everything that takes an index support negative indices from the end including get, set, insert, and remove. Seems more consistent.
Login or Signup to reply.
brian Thu 16 Mar 2006
I posted a bunch of small features to get Lists into a nice usable state:
I added support for closures outside the call's parens for Ruby style:
I added support for generic parameterized closure signatures, so that type checking will occur on your closures:
I fixed list type inference to ignore nulls:
I added support for the common item management methods including [] shortcut support for get/set:
I decided to make everything that takes an index support negative indices from the end including get, set, insert, and remove. Seems more consistent.