-
Notifications
You must be signed in to change notification settings - Fork 23
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
FLIP for removing type requirements #118
Conversation
a175e1c
to
fb9bdff
Compare
Would it be possible to use NFT/FT definitions as examples and show how they'd change based on this FLIP? |
cc @joshuahannan are the contract rewrites for the FT/NFT contracts in a state where we can use them for this FLIP? |
The new versions of the FT and NFT standards already don't use nested type requirements so you can take a look at those: I'd like to merge those with the stable cadence feature branches so we can get them integrated into the preview release also, but just haven't been able to get started on it yet since I'm working on the core contracts right now |
I was thinking if I put events to an interface; I will control all events flowing from there. As we turn into lets say single So allowing others to emit would break the system. |
Practically speaking what @bluesign is suggesting would mean that when an event is declared inside an interface, it would only be available inside that interface's definition. E.g. if I had some event
Then |
I think emit already limits to defined contract scope when called. I think |
That's an interesting point. I think previously the requirement of declaring events as That way, there won't be a need to keep this special casing of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
However, note that this concrete type is actually defined like an interface, and includes no implementation. | ||
Instead, this definiton of `Nested` requires any contracts implementing `Outer` to provide a definition of `Nested` | ||
that conforms to the specification provided in `Outer`. This is called a nested type requirement. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe also explain how ExampleOuter
implements Outer
, so provides a concrete implementation of Outer.Nested
as ExampleOuter.Nested
Co-authored-by: Bastian Müller <[email protected]>
Co-authored-by: Bastian Müller <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feeling good about this. The token standards don't need to be able to define events in the interface anymore since the contract is a concrete type now instead of an interface
Adds a FLIP proposing to remove type requirements and change the semantics of event declarations in interfaces.
Part of onflow/cadence#1283