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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Apologies for the tone. I jumped the gun b/c the message was from a person on your team and I misunderstood it given the question he was replying to.</p>
<p>Now I am happy I got it wrong.</p>
<p>As for making mistakes, that’s not something that scares me but a possibility of eventually falling under the influence of the “strong typers” is.</p>
<p>On the other hand one user on this forum correctly put it that we should have faith in the core team given the track record so far. I agree with him (but fear is a b*tch <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>Thanks</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="314023" data-batch-url="/posts/batch_likers">
                        6
                      </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/jose-valim-elixir-is-officially-a-gradually-typed-language/60850/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-314023" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314023"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="zachallaun" data-post="13" data-topic="60850">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/zachallaun/48/29208_2.png" class="avatar"> zachallaun:</div>
<blockquote>
<pre data-code-wrap="elixir"><code class="lang-elixir">$ MyStruct.t() -&gt; return_type()
def some_function(arg) do
  ...
end
</code></pre>
</blockquote>
</aside>
<p>This looks great, allows people to keep on using Elixir the way they always have, but hey if you want to take it up a notch you can add typed to tighten the bolts of your app. Very cool.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">deft MyStruct.t() -&gt; integer()
def some_function(arg) do
  ...
end
</code></pre>
<p>I like <code>deft</code> cause we got <code>def</code> and <code>defp</code>, why not <code>deft</code> for “define types”? <img src="https://forum.elixirforum.com/images/emoji/apple/smiley.png?v=15" title=":smiley:" class="emoji" alt=":smiley:" 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="314024" data-batch-url="/posts/batch_likers">
                        7
                      </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/jose-valim-elixir-is-officially-a-gradually-typed-language/60850/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-314024" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314024"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think because the %User{} example will cause a match error if a map is passed then its assertive code, and inference about the type should be possible?</p>
<p>Similar to if you had an <code>is_struct(var, User)</code> guard</p>
<p>Adding the type definition either in the function head or above it, would just be icing on the cake.</p>
<p>By having it be a map in the pattern, but saying in the types that it should be a user.</p>
<p>You get compile time checks, but lose the runtime checks. This would probably only bite you with genservers where the incoming type of a message is Any().</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="314025" 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/jose-valim-elixir-is-officially-a-gradually-typed-language/60850/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-314025" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314025"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #23"></div>
  </section>
</div>
    <div class="postbit" id="314028" data-post-id="314028">
  <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>Right, I wasn’t thinking of loosing the runtime check in my example.  You’re right, my examples have different behaviour  …which actually only solidifies my point!</p>
<p>I’m all for types on their own line.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="314028" 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/jose-valim-elixir-is-officially-a-gradually-typed-language/60850/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-314028" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314028"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>There’s so much excitement around static typing that I really want to figure out how to use it effectively.</p>
<p>I spent a lot of time putting in specs for dialyzer and found I spent more time debugging specs than I found bugs.</p>
<p>For my codebase, the compiler showed warnings or the app would just crash on that particular codepath, but dialyzer rarely showed anything useful for the amount of time spent with it. My understanding is that static typing should help in finding bugs without having to go to the runtime of that particular codepath.</p>
<p>Perhaps I’m doing something wrong, but the data coming in from liveview handlers from <code>params</code> or <code>socket.assigns</code> doesn’t have a particular shape to it.</p>
<p>For instance, if I have:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def handle_event("square", params, _socket) do
  number = Parser.safe_to_float(params["number"])
  square(number)
end

@spec square(number :: float) :: float
def square(number) do
  number*number
end
</code></pre>
<p>Pretty much all the data is coming in from input from params, so it doesn’t seem that dialyzer really picks anything up. Am I doing something wrong? Is static typing not going to work for this? Would adding a spec to <code>safe_to_float</code> make a difference? It’s not a small codebase, so I’m hesitant to spend effort on something that might not make a difference.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">github.com/AlDanial/cloc v 1.98  T=0.16 s (1271.0 files/s, 320985.7 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Elixir                         142           4984           9688          26995
EEx                             55            491              0           5758
CSS                              2             84            107           1041
Zig                              4            173            151            933
Markdown                         3            311              9            833
JavaScript                       1             64            113            543
-------------------------------------------------------------------------------
SUM:                           207           6107          10068          36103
-------------------------------------------------------------------------------


</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="314041" 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/jose-valim-elixir-is-officially-a-gradually-typed-language/60850/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-314041" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314041"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I like this as well, <code>deft</code> feels very elixir-ish.</p>
<p>Does anyone know how it would work though, if you had multiple functions with the same name?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="314042" 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/jose-valim-elixir-is-officially-a-gradually-typed-language/60850/27">Post #26</a>
	                </div>
	            </div>
              <div id="likers-container-314042" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314042"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #26"></div>
  </section>
</div>
    <div class="postbit" id="314047" data-post-id="314047">
  <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="joegiralt" data-post="27" data-topic="60850">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/joegiralt/48/4897_2.png" class="avatar"> joegiralt:</div>
<blockquote>
<p>I like this as well, <code>deft</code> feels very elixir-ish.</p>
</blockquote>
</aside>
<p>I don’t see how this would integrate with the current ecosystem and what would be the benefit. If we assume that the new spec will behave like dialyzer, just defining a spec and declaring to explicitly throw error instead of warning on type errors should be more than enough.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="314047" 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/jose-valim-elixir-is-officially-a-gradually-typed-language/60850/28">Post #27</a>
	                </div>
	            </div>
              <div id="likers-container-314047" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314047"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Apologies for a lack of links, but José et al. have explained that <code>@spec</code> is insufficient to fully express set theoretic types without backwards-incompatible changes/breaking Dialyzer, so a new type declaration will be required.</p>
<p>While I don’t believe there are any “official” plans, I guarantee that when/if the new syntax is introduced, some enterprising folk will build tools that ease the transition (e.g. automatically rewriting <code>@spec</code> to <code>$</code> or whatever where it’s unambiguous).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="314059" 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/jose-valim-elixir-is-officially-a-gradually-typed-language/60850/29">Post #28</a>
	                </div>
	            </div>
              <div id="likers-container-314059" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314059"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #28"></div>
  </section>
</div>
    <div class="postbit" id="314061" data-post-id="314061">
  <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>This is true, dialyzer can express only union types.</p>
<p>The question is why <code>deft</code> is by any means necessary and how the new spec aka <code>$</code> will not be enough.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="314061" 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/jose-valim-elixir-is-officially-a-gradually-typed-language/60850/30">Post #29</a>
	                </div>
	            </div>
              <div id="likers-container-314061" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314061"
                     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 #29"></div>
  </section>
</div>
    <div class="postbit" id="314062" data-post-id="314062">
  <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>I don’t think <code>deft</code> makes sense here since we aren’t defining, we’re specifying.  Types are currently defined with <code>@type</code>/<code>@typep</code>/<code>@opaque</code> and I’m not sure that is changing?  I think it would be more like <code>defs</code> for <code>defsignature</code>, or something <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 really personally really like <code>$</code>, though.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="314062" 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/jose-valim-elixir-is-officially-a-gradually-typed-language/60850/31">Post #30</a>
	                </div>
	            </div>
              <div id="likers-container-314062" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314062"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

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