Add support for a new "function type": the array access.
While this adds support in the DSL and in the code generation, I would still consider it experimental on the whole, since:
We have no uniform behaviour for out of bounds indices (e.g. most languages will throw, but each with their own error)
We have no uniform behaviour for negative indices (e.g. Python supports it, but most other languages don't)
We have ugly support in Java for Lists and Arrays: as we don't really have a "type" system, we cannot know if the type of a variable is an array or a list. We thus need to call a wrapper function get which determines it at runtime. Array access in Java thus looks like get(arrayOrList, index) instead of array[index] and list.get(index).
Fixes #325.
Since we will use the [] operator for arrays, we'll use a "magic" function for dictionary/map/object access. That is even more inconsistent in behaviour, so that well be done in another PR eventually.
Add support for a new "function type": the array access.
While this adds support in the DSL and in the code generation, I would still consider it experimental on the whole, since:
get
which determines it at runtime. Array access in Java thus looks likeget(arrayOrList, index)
instead ofarray[index]
andlist.get(index)
.Fixes #325.
Since we will use the
[]
operator for arrays, we'll use a "magic" function for dictionary/map/object access. That is even more inconsistent in behaviour, so that well be done in another PR eventually.