vyper
vyper copied to clipboard
wip: implement methods for structs
What I did
just messing around, opening the PR so others can follow progress
How I did it
How to verify it
Commit message
Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)
Description for the changelog
Cute Animal Picture
A few examples of the intended use might be nice to see for commenting on the implementation
A few examples of the intended use might be nice to see for commenting on the implementation
check commit message - https://github.com/vyperlang/vyper/pull/4041/commits/d94f54819efa7e28b07f4ed4da73d38ff51d6a43
A few examples of the intended use might be nice to see for commenting on the implementation
check commit message - d94f548
@external
def foo(f: Foo):
s: Foo = f
s.decrement_balance(1)
s is only in memory because decrement_balance is a mutable call? would it make sense to have a decorator or additional syntax that delineated view from mutable calls? (or maybe the opposite, @view can be applied to make it non-mutable, which means you can execute this function on f even though it's in calldata)
A few examples of the intended use might be nice to see for commenting on the implementation
check commit message - d94f548
@external def foo(f: Foo): s: Foo = f s.decrement_balance(1)
sis only in memory becausedecrement_balanceis a mutable call? would it make sense to have a decorator or additional syntax that delineated view from mutable calls? (or maybe the opposite,@viewcan be applied to make it non-mutable, which means you can execute this function onfeven though it's in calldata)
i thought about it, i think additional syntax is overkill. it depends more just on the location of the item, like if you can do s.balance -= 1 you can do s.decrement_balance(1)
A few examples of the intended use might be nice to see for commenting on the implementation
check commit message - d94f548
@external def foo(f: Foo): s: Foo = f s.decrement_balance(1)
sis only in memory becausedecrement_balanceis a mutable call? would it make sense to have a decorator or additional syntax that delineated view from mutable calls? (or maybe the opposite,@viewcan be applied to make it non-mutable, which means you can execute this function onfeven though it's in calldata)i thought about it, i think additional syntax is overkill. it depends more just on the location of the item, like if you can do
s.balance -= 1you can dos.decrement_balance(1)
so you would be able to call a non-mutable method on f? that's perfect