<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="294717" data-post-id="294717">
  <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>This clarifies some stuff for me, thanks!  Well, other comments have too but this is a nice summary.</p>
<aside class="quote no-group" data-username="dimitarvp" data-post="165" data-topic="56827">
<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>…Unless I keep misunderstanding the ever-expanding scope of this discussion <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>
</blockquote>
</aside>
<p>Well, unless this is true, of course <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> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="294717" 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/type-system-updates-moving-from-research-into-development/56827/166">Post #165</a>
	                </div>
	            </div>
              <div id="likers-container-294717" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="294717"
                     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 #165"></div>
  </section>
</div>
    <div class="postbit" id="294757" data-post-id="294757">
  <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">
								<blockquote>
<p>So the argument is that <code>_ -&gt; ???</code> is making things strictly more verbose for no added benefit. If you want to better communicate, then using <code>:bar -&gt; ???</code> is better.</p>
</blockquote>
<p>OK sorry for adding confusion, I had the wrong premise which was that this was meant to be used instead of <code>case!</code>, not in conjunction <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>
<blockquote>
<p>Absolutely. I witnessed something very similar many years ago when people were very happliy doing <code>catch (Exception e) { ... }</code> in Java. And that achieved only one thing – it masked bugs.</p>
</blockquote>
<p>I totally understand the rationale, but just wanted to point out that if we go with <code>case!</code>, the same thing will be said of plain <code>case</code> (just like today). It wouldn’t completely “mask bugs” since it still raises, but the compiler loses its ability to check for exhaustiveness.</p>
<p>Just playing the devil’s advocate here for a bit, if we compare these two:</p>
<ol>
<li><code>case</code> / <code>case!</code> to opt-out/in of exhaustiveness, pokemon clauses forbidden</li>
<li>just <code>case</code>, pokemon clause allowed  as the way to opt-out exhaustiveness (my original misunderstanding)</li>
</ol>
<p>Both allow opting out, and opting out will be needed anyway in some cases, so this doesn’t distinguish them. The real differences would be:</p>
<ol>
<li>is more compact and writes less code when opting out</li>
<li>is not without merit either:</li>
</ol>
<ul>
<li>we only need to introduce one thing, <code>???</code>, and it behaves consistently</li>
<li>would also work for function heads (no need for <code>def!</code>, <code>defp!</code>…)</li>
<li>opting-out is noisier/uglier than keeping the check =&gt; easier to notice, stronger deterring effect</li>
</ul>
<aside class="quote no-group quote-modified" data-username="dimitarvp" data-post="165" data-topic="56827">
<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>
<aside class="quote group-Elixir-Core-Team" data-username="sabiwara" data-post="161" data-topic="56827">
<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><code>{:ok, value} = foo()</code>, should it be considered intentionally assertive or warn if <code>foo</code> could also be returning an error tuple?</p>
</blockquote>
</aside>
<p>IMO it should retain the current runtime behavior <em>but</em> issue a warning when ran against the new type checker. It should still compile and run as before and blow up if anything other except an <code>:ok</code> tuple is returned.</p>
</blockquote>
</aside>
<p>Or should we introduce <code>=!</code>? (just kidding).<br>
More seriously, having a warning here would really ruin <code>=/2</code> in most cases and prevent the kind of idiomatic elixir that was being advocated for <a href="https://dashbit.co/blog/writing-assertive-code-with-elixir" rel="noopener nofollow ugc">here</a> (already posted above). That’s a tricky one.</p>
<aside class="quote no-group" data-username="sodapopcan" data-post="164" data-topic="56827" data-full="true">
<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>To be fair, <a class="mention" href="/u/sabiwara" rel="nofollow">@sabiwara</a> <a href="https://forum.elixirforum.com/t/type-system-updates-moving-from-research-into-development/56827/53" rel="nofollow">already said in this thread</a> <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"> I remember because I quietly lol’d to myself at the time.</p>
</blockquote>
</aside>
<p>Oh to be fair I was merely quoting Jose in the first place <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="294757" data-batch-url="/posts/batch_likers">
                        4
                      </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/type-system-updates-moving-from-research-into-development/56827/167">Post #166</a>
	                </div>
	            </div>
              <div id="likers-container-294757" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="294757"
                     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 #166"></div>
  </section>
</div>
    <div class="postbit" id="295303" data-post-id="295303">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="adw632" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  adw632
                  </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="156" data-topic="56827">
<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>This is also tricky. Imagine that you are working with a library that returns <code>:foo or :bar</code> on version v0.1 and <code>:foo or :bar or :baz</code> on v0.2. You update to v0.2 and add the catch all because you don’t care about <code>:baz</code> but you still want to support earlier versions. Matching on <code>:baz</code> will warn that it is unreachable code on v0.1. If we complain that we handle all, then that’s an issue on v0.1 as well.</p>
<p>Now I am going back to thinking that <code>case!</code> maybe the best option, because it is a single char to get all the behaviour you get with let-it crash in <code>case</code> today</p>
</blockquote>
</aside>
<p>Could this API/module versioning conundrum of being damned either way, not be handled by a (custom) guard based on a module version (<code>@vsn</code>) attribute?</p>
<p>Could a custom guard match the version requirement/constraint against the module <code>@vsn</code> attribute?</p>
<p>Basing the guard on <code>SomeModule.__info__(:attributes)[:vsn]</code> and potentially if using semantic versioning,  test the guard version constraint using <code>Version.match?</code></p>
<p>I am certain you could come up with a much cleaner built in way of guarding both functions and clauses based on code evolution concerns like module versions in a way that the compiler type system understands so as to handle API version constraints intelligently (i.e. so as to not complain about impossible cases when compiling against the older/newer version of a module).</p>
<p>It does beg the question would an idealised utopian type checker check against all possible combinations of versions expressed in the code where such constraints are specified?</p>
<p>Whilst this utopian approach is infeasible due to combinatorial explosion,  it does demonstrate that there are some <strong>in principle</strong> practical limits that we can only really be type checking against the exact versions we are actually compiling against and that there will exist combinations of versions where warnings may appear for some, but not for others as we don’t all move <strong>every</strong> dependency in our code base forward in lock step.</p>
<p>I do think the API/module versioning / code evolution concern does require some delicate consideration because it’s right at the heart of the design time checking problems that we do want to know about with the type system. We do want that heads up that we are using a return value that is not possible, due to a typo or no longer present (API evolution), and we do want to know about missing possible values so as to handle them explicitly, whilst also detecting and driving out bad / overspecifiied / defensive catchall/pokemon clauses that occlude future code evolution problems.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="295303" 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/type-system-updates-moving-from-research-into-development/56827/168">Post #167</a>
	                </div>
	            </div>
              <div id="likers-container-295303" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="295303"
                     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 #167"></div>
  </section>
</div>
    <div class="postbit" id="297469" data-post-id="297469">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="adw632" data-post="157" data-topic="56827">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/a/9d8465/48.png" class="avatar"> adw632:</div>
<blockquote>
<p><strong>Catch-all patterns considered harmful</strong>.</p>
</blockquote>
</aside>
<p>This is quite a well-known wisdom in communities using languages with exhaustiveness checking. See Yaron Minsky’s talk “Effective ML” - he talks about catch-all patterns, exhaustiveness, and code evolution over time at 28 minutes into the video: <a href="https://blog.janestreet.com/effective-ml-video/" class="inline-onebox" rel="noopener nofollow ugc">Jane Street Blog - Effective ML video</a><br>
BTW, this material is from 2010!</p>
<p>With a type checker a few more of the techniques he describes there would be possible in Elixir (or Erlang), or at least enforceable at compile time.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="297469" 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/type-system-updates-moving-from-research-into-development/56827/169">Post #168</a>
	                </div>
	            </div>
              <div id="likers-container-297469" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="297469"
                     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>