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

Add render method to Component and auto implement Renderable #563

Merged
merged 6 commits into from
Oct 1, 2019

Conversation

jstarry
Copy link
Member

@jstarry jstarry commented Aug 4, 2019

Fixes: #339

@hgzimmerman
Copy link
Member

hgzimmerman commented Sep 27, 2019

As a thought, to make this a non-breaking change, you could define a FullComponent which is the superset of Component with the added render function and blanket implement impl <T> Component for T where T: FullComponent and impl <T> Renderable<T> for T where T: FullComponent.

I understand that you are opposed to aesthetic-only features, but something like this would allow avoidance of breaking everyone's code, and normalize the existence of something like PureComponent should you choose to include that.

The obvious downsides would be confusion related to differences between FullComponent and Component, and the fact that the dominant Component interface just gained four extra letters.

It might be possible to deprecate Component, then making it private to Yew (something tells me the typesystem may not be fond of this), forcing eventual migration over to FullComponent, Component could be renamed to something like ComponentInternalImpl, and FullComponent could be transitioned in the same way to become Component. So over the course of 5 or so releases you might be able to accomplish a gradual migration back to the normal, minimal trait name with deprecation warnings instead of a single breaking change.

Trait name migration plan:

  1. Add FullComponent and deprecate Component.
  2. Make Component private, forcing downstream crates to switch over to FullComponent.
  3. Reintroduce Component which blanket implements FullComponent, rename old Component to ComponentInternalImpl.
  4. Deprecate FullComponent.
  5. Remove FullComponent, change blanket for Component to blanket impl ComponentInternalImpl.

@jstarry jstarry merged commit 43e9347 into yewstack:master Oct 1, 2019
@jstarry jstarry deleted the component-render branch October 1, 2019 02:23
llebout pushed a commit to llebout/yew that referenced this pull request Jan 20, 2020
…k#563)

* Add render method to Component and auto implement Renderable

* More cleanup

* Rename Renderable method from view to render

* Doc fixes

* fix

* Update CHANGELOG.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Why are Component and Renderable separate traits?
2 participants