User loginNavigation |
Declarative binding vs. compositionRecently, I've been trying to come to grips with pure functional programming (e.g., Haskell) and other potential kinds of declarative languages that work at the level of declarative binding rather than functions (e.g., constraint languages). As an example of the difference, consider how to make a button blue. Using functions, we define a function that creates a new button that is blue; e.g., make_blue(button) -> button let my_blue_button = make_blue(my_original_button) in ... The point of the pure functional approach is that we create new values to reflect new desired realities. Now for the declarative binding (constraint) approach: is_blue_button(a_button) => a_button.background = blue ... assert is_blue_button(my_button) The point of the declarative binding approach is that we refine existing values declaratively to reflect desired realities. Different approach, same result I guess. For reactive programming, I've always been interested in the declarative binding approach with SuperGlue vs. the compositional approach of FRP. However, both approaches seem to have their benefits and drawbacks. Explicit function application gives you more immediate control over the values you produce, but without universal quantification we have to explicitly encode conditions around each application site. Implicit bindings allows things to "just happen" when the right conditions are met, but sometimes we have to struggle to control what goes on. Any thoughts about the different styles? By Sean McDirmid at 2010-01-16 02:20 | LtU Forum | previous forum topic | next forum topic | other blogs | 9942 reads
|
Browse archives
Active forum topics |
Recent comments
27 weeks 2 days ago
27 weeks 2 days ago
27 weeks 2 days ago
49 weeks 3 days ago
1 year 1 week ago
1 year 3 weeks ago
1 year 3 weeks ago
1 year 5 weeks ago
1 year 10 weeks ago
1 year 10 weeks ago