<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="381325" data-post-id="381325">
  <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="7" 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>OK, that’s the definition I’m familiar with (and so still not sold on). How does using a “Traversal” pattern describe intent better than a plain old validate function?</p>
</blockquote>
</aside>
<p>A Traversal is an optic that returns a list of foci. It’s just a pattern for combining <code>Lens</code> and <code>Prism</code>.</p>
<p><code>bind Traversal.to_list_maybe(Processor.cc_payment_trav)</code> states “only let through a transaction that has both an item and a credit card payment.”</p>
<p><code>guard PaymentMustMatchPrice</code> further narrows that to transactions where the item price and payment amount match.</p>
<p>In the pipeline, everything below is skipped if either the traversal or the guard does not match.</p>
<p>The <code>:raise</code> option is where we state that this is an invariant. It either succeeds or raises an error (crashes).</p>
<p>If you’re thinking “couldn’t this just be a single validation?”, yes.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381325" 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/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-381325" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381325"
                     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 #11"></div>
  </section>
</div>
    <div class="postbit" id="381326" data-post-id="381326">
  <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="11" 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>Your definition is interesting but strikes me as fairly esoteric, both in terms of use and remote from connotations of “declarative.” I think I have a vague sense of the connection you’re getting at, but I’ve also heard “self-healing” and “recoverable” as descriptions of that kind of design either of which seem like a much better term?</p>
</blockquote>
</aside>
<p>I think we’re talking past each other a bit on terminology. My use of “declarative” isn’t meant to imply self-healing or recoverable behavior. The examples here fail fast by design. By “declarative” I only mean that the code is describing intent and constraints, not prescribing control flow.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381326" 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/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-381326" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381326"
                     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 #12"></div>
  </section>
</div>
    <div class="postbit" id="381327" data-post-id="381327">
  <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 did not invent this meaning; 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>
<p>FWIW my favorite term to describe how React works is that you write “rewindable” code, but nobody will recognize that if I use it.</p>
<p>Healing and recovery are nice but they imply errors. This is true of OTP crashes but is <em>not</em> true of the general technique. You want to rebuild state not only in the case of a crash but in the case of <em>any</em> state change. Crashing is actually a special case.</p>
<p>If you have spare time and you like databases study FoundationDB and this will become very clear. The whole idea is that they use the same recovery path for state changes <em>and</em> crashes (and they <em>do</em> call it Recovery, and it is a bit of a misnomer for this reason). Also Hobbes uses the same design btw <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>
<p>Another related use of “declarative” is in the context of SQL, where declarative code is useful for a very specific reason (data independence) which is not commonly understood by most devs unless you’re into databases. 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. That article is also a fun treatment of the concept of “declarative”. It really is a bit of a rorschach term 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="381327" 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/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-381327" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381327"
                     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 #13"></div>
  </section>
</div>
    <div class="postbit" id="381328" data-post-id="381328">
  <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="2" 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>But pattern matching is not the tool I would reach for if I wanted to solve the problem in your hypothetical:</p>
</blockquote>
</aside>
<p>Optics are a generic concept. I’m using a common pain point in the examples as a concrete way to show how they work, not as a claim that our only choice in solving this problem is between pattern matching in the function head and the solution I’m showing.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381328" 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/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-381328" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381328"
                     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 #14"></div>
  </section>
</div>
    <div class="postbit" id="381329" data-post-id="381329">
  <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">
								<aside class="quote no-group" data-username="JKWA" data-post="13" 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/jkwa/48/39198_2.png" class="avatar"> JKWA:</div>
<blockquote>
<p>By “declarative” I only mean that the code is describing intent and constraints, not prescribing control flow.</p>
</blockquote>
</aside>
<p>The cause of the confusion (and this long confused me as well) is that in simple cases imperative code looks an awful lot like code which describes intent.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def validate_length(string, length), do: String.length(string) &lt; length
def validate_not_empty(string), do: string != ""

def validate(string) do
  validate_length(string) and validate_not_empty(string)
end
</code></pre>
<p>Like, this code describes its intent pretty well. Is it declarative?</p>
<p>There are actually cases that accentuate the difference well, but they are generally centered around complex state transitions.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381329" 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/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-381329" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381329"
                     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 #15"></div>
  </section>
</div>
    <div class="postbit" id="381330" data-post-id="381330">
  <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="JKWA" data-post="13" 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/jkwa/48/39198_2.png" class="avatar"> JKWA:</div>
<blockquote>
<p>I think we’re talking past each other a bit on terminology. My use of “declarative” isn’t meant to imply self-healing or recoverable behavior.</p>
</blockquote>
</aside>
<p>No, my reply was to <a class="mention" href="/u/garrison" rel="nofollow">@garrison</a> who is using the terminology differently. I don’t really understand either use.</p>
<aside class="quote no-group" data-username="JKWA" data-post="13" 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/jkwa/48/39198_2.png" class="avatar"> JKWA:</div>
<blockquote>
<p>By “declarative” I only mean that the code is describing intent and constraints, not prescribing control flow.</p>
</blockquote>
</aside>
<p>OK, definition has expanded a bit, but nothing I haven’t already heard. What I haven’t heard is how/why this tooling in particular does those things more than other validation patterns.</p>
<aside class="quote no-group" data-username="JKWA" data-post="15" 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/jkwa/48/39198_2.png" class="avatar"> JKWA:</div>
<blockquote>
<p>Optics are a generic concept. I’m using a common pain point in the examples as a concrete way to show how they work, not as a claim that our only choice in solving this problem</p>
</blockquote>
</aside>
<p>Yes, sorry, I should have been clear that I understand the concept of lenses and traversals and they seem like an interesting pattern but my question is more directed that the (implicitly positive) rhetorical use of “declarative.” It doesn’t really help me understand why I should consider this pattern over ones that are simply more familiar to me. Again, not specifically a problem in your presentation, I have never found uses of this term very compelling.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381330" 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/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-381330" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381330"
                     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 #16"></div>
  </section>
</div>
    <div class="postbit" id="381332" data-post-id="381332">
  <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="17" 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>question is more directed that the (implicitly positive) rhetorical use of “declarative.”</p>
</blockquote>
</aside>
<p>Oh, you’re saying you don’t like my use of “declarative” as something implicitly positive.</p>
<p>That’s a fair point. By its nature, declarative code, as I’m using the term, adds at least one level of abstraction, and that indirection has real costs.</p>
<p>Also, under my definition, It’s probably safe to say that only SQL is truly declarative. The rest of us are on a sliding scale.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381332" 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/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-381332" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381332"
                     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 #17"></div>
  </section>
</div>
    <div class="postbit" id="381333" data-post-id="381333">
  <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">
								<p>There were many different implementations of optics in Elixir, namely Lens, Focus and now Funx. I’ve made my own some time ago, called Pathex</p>
<p>The main problem with all other optics solutions is performance, especially with Funx/Witchcraft approaches, where results are wrapped into structures, introducing runtime overhead. In *ML family of languages (and similar languages like Rust) these things are optimized at compile-time into branching, while in elixir every such operation introduces a dispatch on the returned structure and initialization of the new structure.</p>
<p>At the same time Pathex always compiles into almost the most efficient code it can, inlining everything it can, concatenating paths, etc.</p>
<p>Check it out: <a href="https://hexdocs.pm/pathex" class="inline-onebox" rel="noopener nofollow ugc">Pathex v2.6.1 — Documentation</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381333" 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/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-381333" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381333"
                     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="381335" data-post-id="381335">
  <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">
								<p>I like your work!</p>
<p>And I agree. There are times when we need to be as close to the metal as possible, where eliminating runtime abstraction layers matters.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381335" 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/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-381335" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381335"
                     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 #19"></div>
  </section>
</div>
    <div class="postbit" id="381339" data-post-id="381339">
  <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="JKWA" data-post="18" 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/jkwa/48/39198_2.png" class="avatar"> JKWA:</div>
<blockquote>
<p>By its nature, declarative code, as I’m using the term, adds at least one level of abstraction, and that indirection has real costs.</p>
</blockquote>
</aside>
<p>Yes, part of my problem with the term is that it’s often used to simply mean “good” so I appreciate you acknowledging that, since it always involves abstraction, it always has costs as well as benefits.</p>
<p>The other part is I’m still not sure what it means <em>beyond</em> “abstraction.” Certainly, a good abstraction can do all the things that people seem to mean when they use the term “declarative”–it can improve expressiveness, it can encapsulate constraints, etc, indeed, those are precisely the hallmarks of a good abstraction, i.e. good software design. But obviously it needs to signify something more than that in order to be a helpful term and it sounds like you think it does mean something more specific but it’s still unclear to me.</p>
<aside class="quote no-group" data-username="JKWA" data-post="18" 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/jkwa/48/39198_2.png" class="avatar"> JKWA:</div>
<blockquote>
<p>Also, under my definition, It’s probably safe to say that only SQL is truly declarative.</p>
</blockquote>
</aside>
<p>I’ve seen SQL cited as the paradigmatic example of “declarative” especially when stressing the contrast to “imperative” and I think it actually proves my point. Yes, SQL can be defined as a set of abstractions around searching and retrieving (“querying”) data but it’s “goodness” remains highly dubious, likewise its specific similarity to a web FE framework like React.  If I write my own DSL for routing web requests to controllers, the whole point is for the user to avoid telling the computer how to do that themselves (“imperatively”) but I wouldn’t say my DSL <em>in particular</em> is “declarative” due to that.</p>
<p>All that said, I guess something similar could be said about other 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” and I should just get over it. But I find something about declarative particular frustrating. Sorry to hijack your thread! My intention was really to see if there’s something about this pattern in particular that would illuminate the issue for me.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="381339" 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/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-381339" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="381339"
                     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 #20"></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=3">Load more posts (13 remaining)</a>
</div></template></turbo-stream>