Remove support for Array literals
Similar to the removal of Map literal support, this is aimed at
simplifying the syntax and making it more consistent. Arrays are now
created using Array.new
, which takes every value as a separate
argument:
Array.new(10, 20, 30, ...)
To make this more pleasant to work with, the methods StringBuffer.new
and ByteArray.new
now take a rest argument. This means you don't have
to write ByteArray.new(Array.new(...))
, and instead can write
ByteArray.new(...)
. For the StringBuffer
type this requires that we
manually create an instance of it. To remove the need for using VM
instructions directly, we introduce Object.allocate
as a wrapper
around this. This allows one to manually create instances like so:
static def some_method {
let instance = allocate
instance.init(...)
instance
}
Edited by Yorick Peterse