Replies: 2 comments 5 replies
-
|
Good point! I always put all my hyperviews in the same file, even in a large application, so this hasn't come up before. I worked very hard to make the class ergonomic and painless to use, the proposed solution is too complicated, but maybe you could figure something else out. One thing to keep in mind is that while it is very natural to structure modules this way, organizing applications into reusable hyperviews results in brittle object-oriented-like code. Perhaps forcing them all to be in the same module also forces users to come up with other methods of factoring (like composable functions!)
That's not intuitive for me, can you explain why that feels more intuitive to you? |
Beta Was this translation helpful? Give feedback.
-
|
@seanhess How often do you think a child component may want to talk to a parent component? Currently, I can think of 2 ways how this can be possible:
If parent-to-child communication is not generally used, then these (hacks?) methods are all you need. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Thought Experiment:
Parent.hs
Child.hs
These are mutually recursive HyperViews.
If I want functionality like the above, I’m forced to keep both
ParentandChildin the same module.This becomes messy if I want to keep
ParentandChildin separate modules.However, this mutual recursion is unnecessary.
updateofParentdepends ondata Child.updateofChilddepends ondata Parentanddata Action Parent.The
updatefunctions themselves aren’t mutually recursive -they only appear to be because both
Actionandupdateare tied to the same class.It should be possible to split
HyperViewinto two parts:This split provides much more flexibility in how functionality can be organized.
It also makes conceptual sense to separate definitions and relationships from implementation.
There may be better ways to approach this.
The use case described above represents a very natural way to think about UI structure and how UI elements should communicate.
Beta Was this translation helpful? Give feedback.
All reactions