Since array, struct and map are value types, the following syntax does not work.
Map
Map<char, Person> map
map['a'] = new Person(1000)
// override value
map['a'].balance = 1001
// --> map['a'] returns a copy of the struct. Changing the value will not update the map.
Struct
struct Person{
int[] nums
}
Person p = new Person(nums = new int[2])
p.nums[0] = 1
// --> p.nums returns a copy of the array. Changes on array will not be updated on struct.
Array
Person[] p = new Person[2]
p[0] = new Person(100)
p[0].balance = 101
// --> p[0] returns a copy of the struct. Changes will not take effect.
Once VM supports reference types (bazo-blockchain/bazo-vm#28), update the compiler and test them.
Since
array,structandmapare value types, the following syntax does not work.Map
Struct
Array
Once VM supports reference types (bazo-blockchain/bazo-vm#28), update the compiler and test them.