Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value Type Update Issues #78

Open
tk-codes opened this issue May 19, 2019 · 0 comments
Open

Value Type Update Issues #78

tk-codes opened this issue May 19, 2019 · 0 comments
Labels
invalid This doesn't seem right

Comments

@tk-codes
Copy link
Collaborator

tk-codes commented May 19, 2019

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.

@tk-codes tk-codes added the invalid This doesn't seem right label May 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant