jlox already implements the list primitive type (although it doesn't have literal syntax yet). clox should implement it too to have feature parity.
For its expected usage and API, look at samples/list.lox. The only additional piece of syntax needed is for indexing, which takes the form list[index]. In the jlox implementation we experimented with desugaring to a method call to __setitem__ and it worked quite well. We should document this in the (not yet written) spec for Lox.
jlox
already implements thelist
primitive type (although it doesn't have literal syntax yet).clox
should implement it too to have feature parity.For its expected usage and API, look at
samples/list.lox
. The only additional piece of syntax needed is for indexing, which takes the formlist[index]
. In thejlox
implementation we experimented with desugaring to a method call to__setitem__
and it worked quite well. We should document this in the (not yet written) spec for Lox.