<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="327123" data-post-id="327123">
  <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">
								<aside class="quote no-group" data-username="PragTob" data-post="31" data-topic="63278">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/pragtob/48/2401_2.png" class="avatar"> PragTob:</div>
<blockquote>
<p>I mean - there are other ways to do it but I think sharing some data/defaults isn’t too bad.</p>
</blockquote>
</aside>
<p>It’s not, just depends on the “type” of constant and it’s a whole other convo <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"></p>
<aside class="quote no-group" data-username="PragTob" data-post="31" data-topic="63278">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/pragtob/48/2401_2.png" class="avatar"> PragTob:</div>
<blockquote>
<p>That said, I agree that constants in Ruby being “public” by default I don’t like. In that sense, needing to “wrap” a module attribute in a function to make it accessible can be a boon imo <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>
</blockquote>
</aside>
<p>I agree but I was specifically talking about creating a constant and then the <em>only</em> place it’s used is in a function that just returns it.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327123" 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/blog-post-10-elixir-gotchas/63278/32">Post #31</a>
	                </div>
	            </div>
              <div id="likers-container-327123" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327123"
                     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 #31"></div>
  </section>
</div>
    <div class="postbit" id="327125" data-post-id="327125">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sabiwara" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sabiwara/120/18612_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sabiwara
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Elixir Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="PragTob" data-post="27" data-topic="63278">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/pragtob/48/2401_2.png" class="avatar"> PragTob:</div>
<blockquote>
<p>I’d much prefer an exception, as I don’t see when you’d want that behavior. I’m sure I’m missing something, as it was designed by good people.</p>
</blockquote>
</aside>
<p><a class="mention" href="/u/pragtob" rel="nofollow">@PragTob</a> (shameless plug) You might be interested in this micro lib I made, <a href="https://github.com/sabiwara/cmp" rel="noopener nofollow ugc"><code>Cmp</code></a>, with precisely this issue in mind. It should be safe, fast and should always do the right thing out of the box.</p>
<p>Regarding point 4. and <code>is_map(1..10) == true</code>, we decided to introduce a new <a href="https://github.com/elixir-lang/elixir/pull/13534" rel="noopener nofollow ugc"><code>is_non_struct_map/1</code></a> guard in order to be have a simple and blessed way of checking for this (vs <code>is_map(term) and not is_struct(term)</code>).</p>
<p>Thanks a lot for the amazing article!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327125" data-batch-url="/posts/batch_likers">
                        5
                      </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/blog-post-10-elixir-gotchas/63278/33">Post #32</a>
	                </div>
	            </div>
              <div id="likers-container-327125" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327125"
                     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 #32"></div>
  </section>
</div>
    <div class="postbit" id="327137" data-post-id="327137">
  <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">
								<aside class="quote no-group" data-username="PragTob" data-post="31" data-topic="63278">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/pragtob/48/2401_2.png" class="avatar"> PragTob:</div>
<blockquote>
<p>That said, I agree that constants in Ruby being “public” by default I don’t like.</p>
</blockquote>
</aside>
<p>Back when I worked with Ruby still, I just added <code>.freeze</code> after the constant’s definition. Helped my team back then much more often than I expected.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327137" 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/blog-post-10-elixir-gotchas/63278/34">Post #33</a>
	                </div>
	            </div>
              <div id="likers-container-327137" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327137"
                     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 #33"></div>
  </section>
</div>
    <div class="postbit" id="327138" data-post-id="327138">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="PragTob" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/PragTob/120/2401_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  PragTob
                    <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">
								<aside class="quote group-Elixir-Core-Team" data-username="sabiwara" data-post="33" data-topic="63278">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sabiwara/48/18612_2.png" class="avatar"> sabiwara:</div>
<blockquote>
<p><a class="mention" href="/u/pragtob" rel="nofollow">@PragTob</a> (shameless plug) You might be interested in this micro lib I made, <a href="https://github.com/sabiwara/cmp" rel="noopener nofollow ugc"><code>Cmp</code> </a>, with precisely this issue in mind. It should be safe, fast and should always do the right thing out of the box.</p>
</blockquote>
</aside>
<p>Thanks <a class="mention" href="/u/sabiwara" rel="nofollow">@sabiwara</a> ! I was literally debating implementing the same thing (from a cursory look) and post a draft of it like: “Any reason not to do this?”. I was gonna name it Comparable, but I see that’s what you called the protocol and yeah, would have done the same. I had been wondering forever why it isn’t done like this/doesn’t exist. So, thanks a lot! <img src="https://forum.elixirforum.com/images/emoji/apple/green_heart.png?v=15" title=":green_heart:" class="emoji" alt=":green_heart:" loading="lazy" width="20" height="20"></p>
<aside class="quote group-Elixir-Core-Team" data-username="sabiwara" data-post="33" data-topic="63278">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sabiwara/48/18612_2.png" class="avatar"> sabiwara:</div>
<blockquote>
<p>Regarding point 4. and <code>is_map(1..10) == true</code>, we decided to introduce a new <a href="https://github.com/elixir-lang/elixir/pull/13534" rel="noopener nofollow ugc"><code>is_non_struct_map/1</code> </a> guard in order to be have a simple and blessed way of checking for this (vs <code>is_map(term) and not is_struct(term)</code>).</p>
</blockquote>
</aside>
<p>Awesome, sounds useful - thanks again for all your (&amp; the core teams) hard work!</p>
<aside class="quote group-Elixir-Core-Team" data-username="sabiwara" data-post="33" data-topic="63278">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sabiwara/48/18612_2.png" class="avatar"> sabiwara:</div>
<blockquote>
<p>Thanks a lot for the amazing article!</p>
</blockquote>
</aside>
<p>Pleasure + thanks for calling it out <img src="https://forum.elixirforum.com/images/emoji/apple/dancer.png?v=15" title=":dancer:" class="emoji" alt=":dancer:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group" data-username="dimitarvp" data-post="34" data-topic="63278">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<p>Back when I worked with Ruby still, I just added <code>.freeze</code> after the constant’s definition. Helped my team back then much more often than I expected.</p>
</blockquote>
</aside>
<p>I like that (and rubocop suggests it) but it only really fixes a problem with mutability, not with all of them being “public” which isn’t always what you’d want (as I would often just extract constants for naming and even more to avoid wasteful allocations).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327138" 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/blog-post-10-elixir-gotchas/63278/35">Post #34</a>
	                </div>
	            </div>
              <div id="likers-container-327138" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327138"
                     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 #34"></div>
  </section>
</div>
    <div class="postbit" id="327165" data-post-id="327165">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Can we get a non_nil_atom guard too?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327165" 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/blog-post-10-elixir-gotchas/63278/36">Post #35</a>
	                </div>
	            </div>
              <div id="likers-container-327165" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327165"
                     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 #35"></div>
  </section>
</div>
    <div class="postbit" id="327167" data-post-id="327167">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="PragTob" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/PragTob/120/2401_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  PragTob
                    <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 had been thinking about this as well. <code>nil</code>, <code>true</code> and <code>false</code> being atoms is up for the next edition. I think it’s tougher, I can see <code>non_nil</code> but the booleans being in the mix is also somewhat confusing.</p>
<p>Since atoms should be known at compile time I think you’re usually better off making an explicit check against a list of known atoms though aka <code>in [:a, :b, :c]</code></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327167" 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/blog-post-10-elixir-gotchas/63278/37">Post #36</a>
	                </div>
	            </div>
              <div id="likers-container-327167" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327167"
                     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 #36"></div>
  </section>
</div>
    <div class="postbit" id="327187" data-post-id="327187">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sasajuric" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sasajuric/120/991_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sasajuric
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Author of Elixir In Action</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="dimitarvp" data-post="24" data-topic="63278">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<p>Can you expand on that please? How? Can the config scripts be <code>.ex</code> and not <code>.exs</code>?</p>
</blockquote>
</aside>
<p>In a way they can. You can provide many of the values from the regular code (i.e. modules in lib). E.g. both, an Ecto repo and a Phoenix endpoint, can accept params as the first arg passed to <code>start_link</code>.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327187" 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/blog-post-10-elixir-gotchas/63278/38">Post #37</a>
	                </div>
	            </div>
              <div id="likers-container-327187" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327187"
                     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 #37"></div>
  </section>
</div>
    <div class="postbit" id="327193" data-post-id="327193">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="PragTob" data-post="37" data-topic="63278">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/pragtob/48/2401_2.png" class="avatar"> PragTob:</div>
<blockquote>
<p>Since atoms should be known at compile time I think you’re usually better off making an explicit check against a list of known atoms though aka <code>in [:a, :b, :c]</code></p>
</blockquote>
</aside>
<p>Exactly. I rarely see the issue with atoms showing up because, when you want an atom, then you either want all atoms, or you expect some atoms, and then you list the ones you want.</p>
<p>Rather the opposite problem is more common: people using booleans to model problems, when atoms would be clearer. But <a href="https://hexdocs.pm/elixir/design-anti-patterns.html#boolean-obsession" rel="nofollow">boolean obsession/blindness</a> is not an Elixir specific issue. <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="327193" 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/blog-post-10-elixir-gotchas/63278/39">Post #38</a>
	                </div>
	            </div>
              <div id="likers-container-327193" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327193"
                     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 #38"></div>
  </section>
</div>
    <div class="postbit" id="327196" data-post-id="327196">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="39" data-topic="63278">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>when you want an atom, then you either want all atoms, or you expect some atoms, and then you list the ones you want.</p>
</blockquote>
</aside>
<p>How is this much different from maps and structs. You either wants all maps or you pattern match. Still ‘is_map_not_struct’ was added.</p>
<p>Nil is sometimes used as return value for not-existing or undefined (e.g. ecto) so an is_atom check is sometimes used to check if there is a result. Seems to me the guard is not aligned with the expectation of newcomers as mentioning this gotcha receives a lot of love.</p>
<ol>
<li>
<p>That nil, true and false are technically atoms is easy to miss as no colons are needed. Their special status might just as well make them excluded from is_atom imho. Then ‘is_atom’ simply means ‘is a colon keyword’ and debugging symbols align with the match syntax.</p>
</li>
<li>
<p>Exceptions for true and false might be considered, but -I- have never seen that mistake.</p>
</li>
<li>
<p>I wonder if excluding nil, false and true from is_atom would be a breaking change in the sense that (I think) most people probably did not want those values to match in the first place.</p>
</li>
</ol> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327196" 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/blog-post-10-elixir-gotchas/63278/40">Post #39</a>
	                </div>
	            </div>
              <div id="likers-container-327196" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327196"
                     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 #39"></div>
  </section>
</div>
    <div class="postbit" id="327198" data-post-id="327198">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="BartOtten" data-post="40" data-topic="63278">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bartotten/48/25440_2.png" class="avatar"> BartOtten:</div>
<blockquote>
<p>How is this much different from maps and structs. You either wants all maps or you pattern match.</p>
</blockquote>
</aside>
<p>The difference is that you can do a lot of things with maps. For example, I can write:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def foo(%{} = map) do
  Enum.reduce(map, ..., ...)
end
</code></pre>
<p>And that code won’t work for structs or it will work potentially enumerating something else (not tuples representing pairs). Or trying using the access behaviour. You can’t really do many interesting things with atoms besides comparing them, so in my experience, those mix-ups rarely happen. Even in the example you provide, most code checks if something exists or not by precisely checking is_nil/not is_nil (YMMV).</p>
<p>EDIT: That said, we could 100% add a disclaimer to the <code>is_atom/1</code> guard if there isn’t one yet. Plus this is another scenario that can be caught by the type system because in such cases it would know <code>is_atom/1</code> would always return true.</p>
<aside class="quote no-group quote-modified" data-username="BartOtten" data-post="40" data-topic="63278">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/bartotten/48/25440_2.png" class="avatar"> BartOtten:</div>
<blockquote>
<p>I wonder if excluding nil, false and true from is_atom would be a breaking change in the sense that most people probably did not want those values to match in the first place.</p>
</blockquote>
</aside>
<p>It would 100% be a breaking change. For example, implementation of true/false/nil is done via the <code>Atom</code> protocol. So we can’t keep them separate without breaking that. Dialyzer and Erlang as a whole would not share our interpretation of atoms, etc.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="327198" 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/blog-post-10-elixir-gotchas/63278/41">Post #40</a>
	                </div>
	            </div>
              <div id="likers-container-327198" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="327198"
                     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 #40"></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/63278/load_more?page=5">Load more posts (4 remaining)</a>
</div></template></turbo-stream>