On Tue, Apr 8, 2014 at 3:40 PM, Jonas Enlund <[email protected]> wrote:
> I too have been thinking about the concept of cursors. > > Cursors are meant to enable reusable components but the way I see it they > can easily couple your view code with the rest of your program (they are > mutable and are meant to be used that way). If every component takes (and > uses) a cursor are we back to a network of mutable stuff? > No. In Om you have a database-like system + time model. > I think you can achieve the same level of reuse with either callbacks or > channels. As a simple example should a button component expose an on-click > event (or a click channel) or fiddle with application state directly via > cursors, which is more reusable? > I'm of the opinion now that channels are great for application developers. Not good for components, components should probably always take callbacks as their exposed communication interface. It's easy to add async channels over that. > I suppose it’s possible to not use cursors when you don’t have to and I > think that in many cases it’s better for components to not handle state > changes directly themselves and instead emit (either via channels or > callbacks) data about user interactions which can be handled separately by > a different part of your program. Components do not handle state changes themselves, they request state changes via cursors. Cursors handle state changes and cursors are a customizable abstraction by the user. If you want a component to write its state elsewhere go for it. People continue to think that cursors do both more and less than they actually do. I encourage people to actual read and fully understand source before coming to any conclusions as to their purpose. David -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
