-
-
Notifications
You must be signed in to change notification settings - Fork 793
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
VIP: Modify event declaration syntax to resemble that of struct #1864
Comments
Should changing the way logs are emitted also be a part of this proposal? (From Example: event MyEvent:
arg1: indexed(address)
arg2: uint256
...
log(MyEvent({msg.sender, msg.value}))
...
# Extended lines...
log(MyEvent({
msg.sender,
msg.value,
})) |
Approved; makes to align the syntax with |
@iamdefinitelyahuman Let's make this happen with 0.2.0? |
For an event without any arguments: event Foo: pass |
for emitting events, i think To me the ideal syntax would be: log MyEvent(msg.sender, msg.value) |
🚢 🚢 🚢 |
Simple Summary
Change this:
to this:
Motivation
The current approach to declaring an event reads as though there is a variable being created, with it's type defined from the result of a call to an
event
function. This is misleading because:log
.event
, though appearing to be a function, is not a function. And type annotations are not typically declared as the result of a function call.event
is not a standard python behavior until version 3.7. Declaring the fields in this way does not intuitively read as though they are sequenced.By instead using the struct-style declaration, we make it more clear that this not a simple variable, and that the members inside are sequenced.
Backwards Compatibility
This will be a rather large breaking change, we should definitely discuss it at length. If it is approved, it probably belongs in the
1.0rc
release.Copyright
Copyright and related rights waived via CC0
The text was updated successfully, but these errors were encountered: