<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="381341" data-post-id="381341">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tfwright" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tfwright/120/20299_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tfwright
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="garrison" data-post="14" data-topic="73889">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>if you check the three articles I linked you will see it is actually in common use (one is literally the official React blog).</p>
</blockquote>
</aside>
<p>I couldn’t find any references to the term in the first article and the first instance I found in the second sounds much more like the typical definition and upshot is simply that it is an additional layer of abstraction on top of classic FE code which historically has not been complex over the last few decades has become to complex to handle “imperatively,” i.e. without the benefits of specially tailored abstractions. I didn’t see anything that sounded like your definition, but I only skimmed.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381341" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/funx-adding-the-optic-traversal/73889/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-381341" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381341"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #21"></div>
  </section>
</div>
    <div class="postbit" id="381342" data-post-id="381342">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="JKWA" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/JKWA/120/39198_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  JKWA
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Advanced Functional Programming with Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="tfwright" data-post="21" data-topic="73889">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tfwright/48/20299_2.png" class="avatar"> tfwright:</div>
<blockquote>
<p>jargon like “DRY,” where it’s really just a decision to abstract mostly connected to the goal of avoiding duplicating logic, as opposed to making it more “intentful”</p>
</blockquote>
</aside>
<p>For me, DRY matters most when we’re codifying domain rules. Domain logic can drift when a rule is expressed in multiple places. In library code, it’s less about being DRY for its own sake and more about keeping the surface area as small as possible.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381342" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/funx-adding-the-optic-traversal/73889/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-381342" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381342"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #22"></div>
  </section>
</div>
    <div class="postbit" id="381343" data-post-id="381343">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="garrison" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  garrison
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I guess that first article happened not to use the word “declarative” but it does describe the concept. You can find the term <a href="https://legacy.reactjs.org/docs/reconciliation.html" rel="noopener nofollow ugc">all over the place with React</a>. The second provides a simple definition at the top but the rest of the article is about implementation details for React-likes so it’s not going to be as helpful.</p>
<p>The Wittens article has by far the most thorough explanation. Read the first two sections of that and see if it starts to make more sense. He uses a video game analogy in the first section and then provides a more detailed webapp example in the second.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381343" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/funx-adding-the-optic-traversal/73889/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-381343" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381343"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #23"></div>
  </section>
</div>
    <div class="postbit" id="381344" data-post-id="381344">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="JKWA" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/JKWA/120/39198_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  JKWA
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Advanced Functional Programming with Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="tfwright" data-post="21" data-topic="73889">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tfwright/48/20299_2.png" class="avatar"> tfwright:</div>
<blockquote>
<p>Yes, SQL can be defined as a set of abstractions around searching and retrieving (“querying”) data but it’s “goodness” remains highly dubious,</p>
</blockquote>
</aside>
<p>There might be another way to look at this.</p>
<p>SQL has a limited set of well-defined operations. This makes it a good syntax for new database implementations, where they can start with a subset like select and filtering, then later add joins and window functions.</p>
<p>Ash and Ecto also compile their query DSL down to SQL, using it as an adapter across different database implementations.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381344" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/funx-adding-the-optic-traversal/73889/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-381344" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381344"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #24"></div>
  </section>
</div>
    <div class="postbit" id="381346" data-post-id="381346">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tfwright" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tfwright/120/20299_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tfwright
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="garrison" data-post="24" data-topic="73889">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>The Wittens article has by far the most thorough explanation. Read the first two sections of that and see if it starts to make more sense.</p>
</blockquote>
</aside>
<p>I’ve read that before start to finish, I think maybe you linked it last time we tried to tackle this <img src="https://forum.elixirforum.com/images/emoji/apple/sweat_smile.png?v=15" title=":sweat_smile:" class="emoji" alt=":sweat_smile:" loading="lazy" width="20" height="20"> . I like his explanation the best but am still unconvinced about the usefulness of the category. To me, the main example from the beginning involving tabs mainly shows the limitations of trying to maintain complex set of logic paths without relying on any abstractions to help. It’s not as if the example shows one abstraction that is somehow not “declarative” and then shows how a properly “declarative” abstraction would do better. It is simply an example of a suitable abstraction for the case.</p>
<p>It does seem like the peculiarity of the term “declarative” makes the most sense in contexts like the FE, where the complexity involved is often managing sets of interdependent “nodes,” each as you point out with their own state, so that the type of abstractions that prove to be useful are usually ways to concisely express a desired snapshot of related data, vs something like my router DSL example or your validation example. So maybe I can convince myself that this is a certain “style” of abstraction but isn’t that what we usually call a pattern?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381346" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/funx-adding-the-optic-traversal/73889/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-381346" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381346"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #25"></div>
  </section>
</div>
    <div class="postbit" id="381348" data-post-id="381348">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="garrison" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  garrison
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>It’s not necessarily about abstraction; or, rather, <em>everything</em> is an abstraction so this is vacuous.</p>
<p>The technique, very simply, is that when you have state changes you want to avoid mutating derived state manually. Instead, you want to shove everything down one codepath that recomputes the derived state from scratch. All of it, in one pass.</p>
<p>The first example he gives is the video autoplaying on a particular tab. What you do <em>not</em> want to do is have some tab click event handler that mutates the “video is playing” state. That’s imperative. Instead, you want the decision about whether a video should be playing to be <em>downstream</em> of the selected tab, e.g. by “re-rendering” the entire component from scratch. That’s declarative.</p>
<p>You do not need a framework to do this. You just need to structure your code the right way.</p>
<aside class="quote no-group" data-username="tfwright" data-post="26" data-topic="73889">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tfwright/48/20299_2.png" class="avatar"> tfwright:</div>
<blockquote>
<p>It does seem like the peculiarity of the term “declarative” makes the most sense in contexts like the FE, where the complexity involved is often managing sets of interdependent “nodes,” each as you point out with their own state</p>
</blockquote>
</aside>
<p>The reason most of the literature on this topic is from the frontend side is that frontend is harder than backend. How we ended up drawing this arbitrary line between FE and BE is beyond me, but for some reason all of the hard stuff ended up in FE. Because it’s the part the users actually have to use, I guess.</p>
<p>If you try to work on the more difficult stuff in backend (e.g. distributed reconfiguration databases) then I can confirm that the same technique applies and is useful. As I said, FoundationDB uses the same principle to avoid branching codepaths in its recovery logic. But <a href="https://apple.github.io/foundationdb/architecture.html#transaction-system-recovery" rel="noopener nofollow ugc">their docs are terrible</a> so I can’t link you a good source other than “trust me I know exactly how it works because I reimplemented the entire thing from scratch”.</p>
<p>What’s funny about “traditional” HTML apps is that they are rendered entirely declaratively. They take URL state and output an entire page. It was only once people started manipulating stuff with XHR and JS that things went off the rails and they had to invent React to <em>restore</em> the declarative nature they had lost.</p>
<p>The difference between React and a standard HTML server render is that React is <em>incremental</em>, but that’s actually a <em>performance</em> trick. It is, in reality, too slow to re-render an entire HTML page for every little interaction.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381348" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/funx-adding-the-optic-traversal/73889/27">Post #26</a>
	                </div>
	            </div>
              <div id="likers-container-381348" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381348"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #26"></div>
  </section>
</div>
    <div class="postbit" id="381351" data-post-id="381351">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="derek-zhou" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/derek-zhou/120/19943_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  derek-zhou
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="garrison" data-post="27" data-topic="73889">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>It is, in reality, too slow to re-render an entire HTML page for every little interaction.</p>
</blockquote>
</aside>
<p>This may not be true anymore. Computers and browsers have come a long way.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381351" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/funx-adding-the-optic-traversal/73889/28">Post #27</a>
	                </div>
	            </div>
              <div id="likers-container-381351" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381351"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #27"></div>
  </section>
</div>
    <div class="postbit" id="381352" data-post-id="381352">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tfwright" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tfwright/120/20299_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tfwright
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="garrison" data-post="27" data-topic="73889">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>It’s not necessarily about abstraction; or, rather, <em>everything</em> is an abstraction so this is vacuous.</p>
</blockquote>
</aside>
<p>Well, that’s my point exactly. <em>If</em> declarative in essence is just about abstraction then it’s vacuous. What continues to be difficult for me to see is what defines a declarative abstraction precisely. In my judgment most existing definitions are not cogent, and the examples too non-specific.</p>
<aside class="quote no-group" data-username="garrison" data-post="27" data-topic="73889">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>The technique, very simply, is that when you have state changes you want to avoid mutating derived state manually. Instead, you want to shove everything down one codepath that recomputes the derived state from scratch. All of it, in one pass.</p>
</blockquote>
</aside>
<p>The definition you’re getting out is more promising, and maybe I need to read through some of this material more closely, but this still sounds a bit too general and too specific at the same time. It clearly is something different than what <em>most</em> people seem to mean by it, which is frankly the use I have the most problems with. It might be there is a proper use of this term that has been diluted more and more as its use has spread, especially into the BE.</p>
<aside class="quote no-group" data-username="garrison" data-post="27" data-topic="73889">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>The reason most of the literature on this topic is from the frontend side is that frontend is harder than backend.</p>
</blockquote>
</aside>
<p>I mean, it doesn’t have to be <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"> but yes in the last decade or two the pursuit of more UI features has made the web a lot more complex on the FE (personally not thrilled tbh). One way to rephrase my question might be, what is it about this new FE complexity has given so much force to the concept of “declarative” programming? How does the term itself help steer us in the right directions when making architectural decisions on the FE? Even between frameworks?</p>
<p>I have been locked into React for years, but I’ve really like the spirit of what I’ve seen of htmx (not in small part due to my affection for the <a href="https://grugbrain.dev/" rel="noopener nofollow ugc">grug brained manifesto</a> from the author–definitely my favorite software engineering manifesto). I suppose a lot of people would say it’s not declarative, but I’m not sure if I should care or not lol</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381352" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/funx-adding-the-optic-traversal/73889/29">Post #28</a>
	                </div>
	            </div>
              <div id="likers-container-381352" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381352"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #28"></div>
  </section>
</div>
    <div class="postbit" id="381355" data-post-id="381355">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Asd" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Asd
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="garrison" data-post="14" data-topic="73889">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>Incidentally the declarative-ness of SQL has <a href="https://www.scattered-thoughts.net/writing/unexplanations-sql-declarative/" rel="noopener nofollow ugc">nothing to do with query <em>optimization</em></a>, which is what most people seem to think</p>
</blockquote>
</aside>
<p>I’ve read the blog post and it is very funny.<br>
Quote</p>
<blockquote>
<p>So our minimum requirements for interesting program transformations include:</p>
<ol>
<li>Static typing (so that we know what values look like).</li>
<li>Static dispatch (so that we know which functions will be called).</li>
<li>Some way to reason about the properties of functions (eg that a == b implies hash(a) == hash(b) or that addition is commutative).</li>
<li>Some way to reason about which values are finite and which functions terminate.</li>
<li>Some way to reason about the time and space cost of functions (so that we can predict if a given transformation is worthwhile).</li>
<li>Some way to reason about the effects caused by calling functions (eg by only allowing pure functions, or by tracking effects and aliasing in the type system).</li>
</ol>
</blockquote>
<p>While I can say that most of these points are not true (for example functions can sometimes be speculated and made pure by postponing effects, etc.), but it generally describes a qualities of declarative programming language, not the imperative one.</p>
<hr>
<p>To put my 2 cents into the overall discussion, I think that declarativeness and imperativeness are not two separate opposites and not even a spectrum, but are just qualities of information description or code.</p>
<p>Here’s a table to demonstrate the idea, where languages in boxes are the most extreme examples I can think of.</p>
<div class="md-table">
<table>
<thead>
<tr>
<th></th>
<th>Not declarative</th>
<th>Declarative</th>
</tr>
</thead>
<tbody>
<tr>
<td>Not imperative</td>
<td>Prolog</td>
<td>Markdown</td>
</tr>
<tr>
<td>Imperative</td>
<td>Assemble</td>
<td>SVG</td>
</tr>
</tbody>
</table>
</div><p>For example, Prolog is neither declarative, nor imperative, because it is logical. You dont state the instructions and you dont explain the expected result, you just define rules and then ask questions.</p>
<p>Markdown is declarative, because it describes the end result: a text document. Different editors and viewers decide how to render it.</p>
<p>Assembly is imperative, because all you have is a set of instructions. You don’t describe the end result in any way, you just write down a bunch of instructions which bring to the end result.</p>
<p>And SVG is both declarative and imperative, because it defines an image as a set of curves and shapes and then it lets user apply some changes and actions (some transforms) to these curves, in any order. So it contains both a description of an image and some very detailed instruction on how to change the image. I think CSS also belongs to the same category.</p>
<p>Most general purpose Turing-complete programming languages (like C, Haskell, Elixir or Python) are somewhere in-between, some are leaning more to one thing or another, or some leaning more towards both (like Scala or C++, for example).</p>
<p>This information is fun to know, but for me personally, it is completely useless <img src="https://forum.elixirforum.com/images/emoji/apple/grinning_cat_with_smiling_eyes.png?v=15" title=":grinning_cat_with_smiling_eyes:" class="emoji" alt=":grinning_cat_with_smiling_eyes:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381355" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/funx-adding-the-optic-traversal/73889/30">Post #29</a>
	                </div>
	            </div>
              <div id="likers-container-381355" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381355"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></div>
  </section>
</div>
    <div class="postbit" id="381356" data-post-id="381356">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="garrison" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  garrison
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>It is actually much more complicated than that, but I didn’t want to get into it.</p>
<p>Actually if you think about it the page is rendered at 60hz no matter what you do. And this gets into “immediate mode GUI” and so on.</p>
<p>What happened with React is a funny coincidence, where it was created to incrementalize DOM updates (because the DOM is slow, and still is today to be clear). But in the process they somewhat accidentally created a tool which is useful for incrementalizing <em>application code</em>. So even if you get rid of the (useless) DOM, something like React is still meaningful.</p>
<p>Wittens (the third article) work in the area is on <code>use.gpu</code>, a framework that provides an incremental, declarative GPU API. And Levien’s work (the second article) was in the context of a UI library for Rust, where they have no DOM, and he goes into that. Both of these individuals, by the way, are <em>very</em> experienced graphics programmers, not a couple of webdev rookies <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381356" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/funx-adding-the-optic-traversal/73889/31">Post #30</a>
	                </div>
	            </div>
              <div id="likers-container-381356" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381356"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #30"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/73889/load_more?page=4">Load more posts (3 remaining)</a>
</div></template></turbo-stream>