-
Notifications
You must be signed in to change notification settings - Fork 156
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
Page trait proposal #322
Comments
I'm sorry but I can't see the benefit. What concrete problem do you want to solve? |
It's easier to learn and should be easier to compose. Though I haven't put enough thoughts in it yet. But anyways I think it's worth to evaluate the idea. |
I agree on using traits, but not single trait for flexibility. I already opened an issue #310 but it's now closed .. |
Just a note, but that particular approach is the one adopted by |
In other words - you want to remove boilerplate (?). Boilerplate (aka wiring/plumbing) is the known trade-off for single source of truth and flexible/minimalist API in Elm architecture. I was thinking about it and I've read some Elm books and many other sources / docs (Redux, Overmind + CerebralJs, React Hooks, HyperApp, Vuex, etc.). And I think it's the fight boilerplate vs local state or strictly defined module API (init, update, view, etc.):
|
Having spent quite a bit of time with local state hacking vs TEA I think there are benefits (and drawbacks) to both approaches. As Martin suggested above it's difficult to decide what would ho in local state and what correctly goes in the global/module seed model. The fact that TEA is about as clean and explicit as you can get should not be underestimated. There is something great about having the entire app model being a self consistent representation of app state, it means following logic and assessing the impact of mutations to that state is straightforward. It also means things like undo would in theory be easier to implement because Messages or Commands are the only way to cause a state change. Now that said the big draw back to the explicit wiring (boilerplate) is not in my mind the boilerplate itself but rather the difficulty in creating librarys of components that can be dropped into any seed app and just work. This is where React hooks have been particularly successful because they have enabled functionality to be added to apps fully encapsulated. In my mind a proper react hooks style api could complement TEA however it would require restraint on the part of the developer. So in short I think the current seed Model Msg api is just fine. If you give it up you lose more than you gain. However I think there is some space for that escape hatch if carefully considered. |
What do you think about uniting
Model
,Msg
,update
andview
?Model
is represented bySelf
in this approach.And the implementation:
so you can finally:
This should simplify reasoning, because now you only need to learn 1 thing,
Page
trait.The rest will be guided by the compiler.
The text was updated successfully, but these errors were encountered: