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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think he meant to reply to me, maybe. But yeah I looked at the library and I find it nice on a second look.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="320867" 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/kword-a-library-of-keyword-list-handling-functions-to-complement-keyword/62246/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-320867" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="320867"
                     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="320874" data-post-id="320874">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="spacebat" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/spacebat/120/25330_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  spacebat
                    <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>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I definitely want to know more on the tradeoffs with this stuff, and this thread has been very informative. The feedback has been constructive, thanks <img src="https://forum.elixirforum.com/images/emoji/apple/slightly_smiling_face.png?v=15" title=":slightly_smiling_face:" class="emoji" alt=":slightly_smiling_face:" 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="320874" 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/kword-a-library-of-keyword-list-handling-functions-to-complement-keyword/62246/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-320874" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="320874"
                     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="320881" data-post-id="320881">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>For me I usually want it all with typing or I just use <code>Keyword.get</code>, which I do not agree is “harmful”.  I don’t want to get to into it, though, otherwise <a class="mention" href="/u/dimitarvp" rel="nofollow">@dimitarvp</a> and I might get going <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 could actually see your lib as a nice middle ground.  I bookmarked it and will try to remember to try it next time I go to use <code>Keyword.get</code>.</p>
<p>EDIT: Maybe I do consider it a <em>little</em> harmful <img src="https://forum.elixirforum.com/images/emoji/apple/rofl.png?v=15" title=":rofl:" class="emoji" alt=":rofl:" 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="320881" 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/kword-a-library-of-keyword-list-handling-functions-to-complement-keyword/62246/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-320881" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="320881"
                     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="320924" data-post-id="320924">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>As with everything else we use, it is considered harmful when it expresses the wrong intent.</p>
<p>I use <code>Keyword.get/3</code> in situations where an option might be missing and I have a default value for it. For example:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">Keyword.get(opts, :option, default_value)
</code></pre>
<p>Using it in cases where having that key missing is invalid logic, you are just propagating a bug further into the system. This is especially bad when you leave the default value to <code>nil</code> and propagate it further, hard to debug and trace down.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="320924" data-batch-url="/posts/batch_likers">
                        3
                      </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/kword-a-library-of-keyword-list-handling-functions-to-complement-keyword/62246/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-320924" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="320924"
                     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="320927" data-post-id="320927">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Noooo arguments here!</p>
<p>It’s mostly I’m starting to somewhat buy <a class="mention" href="/u/dimitarvp" rel="nofollow">@dimitarvp</a>’s argument that it doesn’t make a distinction if the key is there or not.  Now, this is not news to me, not by a long shot!  My of use <code>Keyword.get</code> is for simple options where I don’t want to break out <code>NimbleOptions</code>, but I still operate under the idea that there is a contract in place.  IE, I create a world where <code>nil</code> is never going to be passed (which is the whole “parse don’t validate” thing I love to talk about ad nauseam).  I would never use <code>Keyword.get</code> for user-passed data!!!  However, in the “real world” where juniors are running rampant on your dynamic-language codebase, maybe a <code>nil</code> slips in there.  AFAIC, if you’re using <code>nil</code> for its intended use to mean “nothing”, when it comes to <em>options</em> there shouldn’t be a difference between <code>nil</code> and “key wasn’t specified.”  If you buy that (and maybe you don’t!), <code>Keyword.get</code> <em>is</em> actually dangerous:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">Keyword.get([some_list: nil], :some_list, []) #=&gt; nil
</code></pre>
<p>Undoubtedly to <a class="mention" href="/u/dimitarvp" rel="nofollow">@dimitarvp</a>’s horror, one conclusion I draw from this is that <code>Access</code> is actually better:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">some_list = options[:some_list] || [] #=&gt; []
</code></pre>
<p>Of course this sucks if your option is a boolean.  You can’t do:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">some_bool = options[:drop_database] || true
</code></pre>
<p>We could always exploit truthiness there but even as a fan of truthiness I don’t like this one bit.</p>
<p>Circling back, having what should be a list become a <code>nil</code> <em>should</em> fail pretty fast but I guess you never know in this scenario.</p>
<p>So really I’m starting to think I just <em>always</em> want typed options.  Even the other day I passed a non-existant option to a well-known library and it didn’t yell at me and I was pretty annoyed.  There certainly is a difference between library and application code, though, so I’ll see <img src="https://forum.elixirforum.com/images/emoji/apple/grin.png?v=15" title=":grin:" class="emoji" alt=":grin:" 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="320927" 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/kword-a-library-of-keyword-list-handling-functions-to-complement-keyword/62246/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-320927" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="320927"
                     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="320930" data-post-id="320930">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="sodapopcan" data-post="16" data-topic="62246">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sodapopcan/48/34668_2.png" class="avatar"> sodapopcan:</div>
<blockquote>
<p>So really I’m starting to think I just <em>always</em> want typed options. Even the other day I passed a non-existant option to a well-known library and it didn’t yell at me and I was pretty annoyed. There certainly is a difference between library and application code, though, so I’ll see <img src="https://forum.elixirforum.com/images/emoji/apple/grin.png?v=15" title=":grin:" class="emoji" alt=":grin:" loading="lazy" width="20" height="20"></p>
</blockquote>
</aside>
<p>This is true 100%. It is strange to me how OTP has checks for options from long ago, but elixir never adopted that convention until lately.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="320930" 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/kword-a-library-of-keyword-list-handling-functions-to-complement-keyword/62246/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-320930" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="320930"
                     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="320931" data-post-id="320931">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="spacebat" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/spacebat/120/25330_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  spacebat
                    <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>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>On a tangent, Perl5 has a <code>//</code> operator, which is like the logical or <code>||</code> but only treats <code>undef</code> as falsey. Useful for disambiguating nil/null/undefined/missing values from defined but false ones.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="320931" data-batch-url="/posts/batch_likers">
                        3
                      </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/kword-a-library-of-keyword-list-handling-functions-to-complement-keyword/62246/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-320931" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="320931"
                     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="321491" data-post-id="321491">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Maybe a little bit of scope might help here. How long do you think keyword lists will get in the context of passing them into functions? 10, 100 but even if it had 1000 I would not consider optimizing and simply do the following</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">opts
|&gt; Keyword.validate!(...)
|&gt; Enum.into(%{})
|&gt; Map.values
</code></pre>
<p>and similar for <code>Keyword.validate/2</code> (with a <code>with</code>, I guess <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" 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="321491" 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/kword-a-library-of-keyword-list-handling-functions-to-complement-keyword/62246/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-321491" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="321491"
                     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 #18"></div>
  </section>
</div>
    <div class="postbit" id="321501" data-post-id="321501">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="RobertDober" data-post="19" data-topic="62246">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/robertdober/48/4842_2.png" class="avatar"> RobertDober:</div>
<blockquote>
<pre data-code-wrap="elixir"><code class="lang-elixir">opts
|&gt; Keyword.validate!(...)
|&gt; Enum.into(%{})
|&gt; Map.values
</code></pre>
</blockquote>
</aside>
<p>Have to correct myself, (bad Ruby influence <img src="https://forum.elixirforum.com/images/emoji/apple/angel.png?v=15" title=":angel:" class="emoji" alt=":angel:" loading="lazy" width="20" height="20"> ) <code>Map.values</code> will not get us the correct order</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="321501" 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/kword-a-library-of-keyword-list-handling-functions-to-complement-keyword/62246/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-321501" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="321501"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>