[Ur] Client-side programming style

Adam Chlipala adamc at impredicative.com
Fri Jan 22 10:26:27 EST 2010


Artyom Shalkhakov wrote:
> After looking at the example dlist module, I noticed that it was much
> more elaborate. What is the reason for that?

The biggest reason is performance.  With the naive list-based technique, 
consider what happens when you want to change one element of the list: 
you must regenerate the whole page section for the list.  With Dlist, 
only the section for the particular element is recomputed.

There are also a few observable side effects of recomputation.  For 
instance, the cursor position in a textbox will be reset, even if that 
textbox isn't part of the rendering of the list element you've changed.  
If you want to avoid these consequences, you might prefer Dlist or a 
similar approach.

> Also, I found that code
> hard to follow; is there a nice metaphor or something to help making
> sense out of that code?
>    

Did you try to understand the signature first?  It's meant to be easy to 
understand as an alternate presentation of lists with extra reactive 
functionality.



More information about the Ur mailing list