Closed dwightguth closed 6 years ago
What should the semantics of makeArray(5, 0)[7]
be? That is, should it return the default value 0
, or some error term because 7
it outside the bounds of the array?
makeArray(5, 0)[7]
and makeArray(5, 0)[7 <- 1][7]
should both be zero. The idea behind ARRAY is that an efficient implementation backs an array as an actual array with a fixed length, so any element not explicitly assigned or outside the length of the array is always equal to the default value.
As @dwightguth pointed out I missed that we only support one test definition per directory, so making a subdirectory for the tests previously directly in test/builtins
is a good idea before making test/builtins/array
.
Please add tests.