Change this:
Transfer: event({_from: indexed(address), _to: indexed(address), _value: uint256})
to this:
event Transfer:
_from: indexed(address)
_to: indexed(address)
_value: uint256
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.
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 and related rights waived via CC0
Should changing the way logs are emitted also be a part of this proposal?
(From log.<EventName>({...}) to log(EventName({...})))
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 struct.
@iamdefinitelyahuman Let's make this happen with 0.2.0?
For an event without any arguments:
event Foo: pass
for emitting events, i think log is better as a statement. Also, I don't like the use of curly brackets inside the call, I don't think they serve any purpose.
To me the ideal syntax would be:
log MyEvent(msg.sender, msg.value)
:ship: :ship: :ship: