<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="314462" data-post-id="314462">
  <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="48" 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/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>At this moment, I’d say we should put signatures after the docs and grouped immediately before the first clause, since they help both with the documentation and code. And I want them grouped because I want a unified view of how my function behaves and not scattered across multiple lines.</p>
</blockquote>
</aside>
<p>Given functions with multiple clauses it is often required to declare a function head for documentation purposes:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def size(map_with_size)
def size(%{size: size}) do
  size
end
</code></pre>
<p>The documentation currently infers the function argument types and no doubt any additional type annotations could improve that, but the doc function argument labelling <em>requirement</em> will remain.</p>
<p>Given multiple function heads with different type signatures, it would be something to consider that we don’t have to declare all 3 things orthogonally:</p>
<ul>
<li>the function with its arguments and guards</li>
<li>the function type annotations (repeating the guard constraints?)</li>
<li>the function head documentation signature labelling the arguments</li>
</ul>
<p>I know it’s early days but are there any thoughts on some kind of convergance of annotations with documentation,  (aka doctypes) being considered?</p>
<p>I certainly don’t want more distractions on function heads but I also like the type annotation to be immediately above the function body it actually applies to like <code>@attr</code> in Phoenix components and not grouped up away from the function definition.</p>
<p>I would be concerned of the disconnect between type annotation and the function body it applies to. It’s not hard to conceive of example where it would be quite a bit of mental analysis to determine which type annotation applies to what function variant.</p>
<p>I was also thinking that what is done for Phoneix components is an existing example of documenting types and expectations.</p>
<p>Components specify type constraints and documentation for a single assigns argument which are compile time checked <em>and</em> produce useful documentation.</p>
<p>Could something similar to this style of approach be extended to all function arguments merging the document action and the constraints?</p>
<p>Could we specify constraints on maps, keyword lists and fields of structs. Given component <code>@attr</code> and <code>@slot</code> annotations are already constraining an assigns map is this a useful use case to model?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="314462" 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/52">Post #51</a>
	                </div>
	            </div>
              <div id="likers-container-314462" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314462"
                     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 #51"></div>
  </section>
</div>
    <div class="postbit" id="314464" data-post-id="314464">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Congratulations on the announcement <a class="mention" href="/u/josevalim" rel="nofollow">@josevalim</a> and all the contributors! These are very exciting news.</p>
<p>I’m somewhat new to Elixir and its ecosystem; however, the little developer experience I’ve had so far has been quite impressive and pleasant. So much, that I’m very inclined to build my next web project on Elixir / Phoenix, instead of Rust (my forte for the past ~4 years).</p>
<p>Given my background, reading the <a href="https://elixir-lang.org/blog/2023/09/20/strong-arrows-gradual-typing/" rel="nofollow">Strong arrows: a new approach to gradual typing - The Elixir programming language (elixir-lang.org)</a> was really interesting, particularly the point of <strong>set-theoretic types</strong> based on <em>union, intersection and negation</em>, the <strong>bounded quantification feature</strong>…</p>
<p>It is, at least in my limited understanding, quite relatable to Rust’s trait bound system; which is -imho- one of Rust’s most powerful features:</p>
<pre data-code-wrap="rust"><code class="lang-rust">fn some_function&lt;T, U&gt;(t: &amp;T, u: &amp;U) -&gt; i32
where
    T: Display + Clone,
    U: Clone + Debug,
{ ... }
</code></pre>
<p>In that function type “T” has to be “displayable” <em>AND</em> “clonable”, and “U” needs to be “clonable” <em>AND</em> “debuggable” or the compiler will scream at you.</p>
<p>From what I understand Elixir’s <strong>strong arrows</strong> would work in a similar fashion but using guards and pattern matching instead of traits:</p>
<pre data-code-wrap="Elixir"><code class="lang-Elixir">$ a -&gt; a when a: number()
def identity(arg) when is_number(arg), do: arg
</code></pre>
<p>Here, I understand, the compiler will complain if <code>a</code> is not a number, with this cherry on top:</p>
<blockquote>
<p>The type system will also perform limited <strong>inference based on patterns and guards</strong> (as described in the paper), which - in addition to strong arrows - we hope to bring some of the benefits of static typing to codebases without changing a single line of code</p>
</blockquote>
<p>And from what I’m reading on <a href="https://arxiv.org/abs/2306.06391" rel="noopener nofollow ugc">[2306.06391] The Design Principles of the Elixir Type System (arxiv.org)</a> it will also provide <em><strong>exhaustive</strong></em> checking for <code>case</code> expressions. Which is also another feature from Rust that is really good.</p>
<p>The future of Elixir looks really promising!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="314464" 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/53">Post #52</a>
	                </div>
	            </div>
              <div id="likers-container-314464" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314464"
                     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 #52"></div>
  </section>
</div>
    <div class="postbit" id="314468" data-post-id="314468">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cmo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cmo/120/19618_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cmo
                  </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="52" data-topic="60850">
<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>I certainly don’t want more distractions on function heads but I also like the type annotation to be immediately above the function body it actually applies to like <code>@attr</code> in Phoenix components and not grouped up away from the function definition.</p>
<p>I would be concerned of the disconnect between type annotation and the function body it applies to. It’s not hard to conceive of example where it would be quite a bit of mental analysis to determine which type annotation applies to what function variant.</p>
</blockquote>
</aside>
<p>How about the editor plugins optionally display the type signature(s) above all function heads?</p>
<p>Personally, I find the <code>doc</code> part of <code>attrs</code> really harshest my tidy-vibe.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="314468" 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/54">Post #53</a>
	                </div>
	            </div>
              <div id="likers-container-314468" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314468"
                     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 #53"></div>
  </section>
</div>
    <div class="postbit" id="314470" data-post-id="314470">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I would imagine the formatter will settle this once (if) we get them added the language.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="314470" 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/55">Post #54</a>
	                </div>
	            </div>
              <div id="likers-container-314470" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314470"
                     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 #54"></div>
  </section>
</div>
    <div class="postbit" id="314614" data-post-id="314614">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/josevalim" rel="nofollow">@josevalim</a> any rough timeline idea? can’t wait much more <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="314614" 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/56">Post #55</a>
	                </div>
	            </div>
              <div id="likers-container-314614" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314614"
                     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 #55"></div>
  </section>
</div>
    <div class="postbit" id="314619" data-post-id="314619">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="arcanemachine" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/arcanemachine/120/29109_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  arcanemachine
                    <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>You’ll be waiting a few more months for the inital rollout, at least:</p>
<aside class="quote group-livebook_core_team quote-modified" data-username="josevalim" data-post="19" data-topic="60850" 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/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>Thank you <a class="mention" href="/u/fl4m3ph03n1x" rel="nofollow">@Fl4m3Ph03n1x</a>!</p>
<p>To align everyone’s expectations, our goal is to perform inference of all patterns and guards by Elixir v1.17, as outlined here: <a href="https://elixir-lang.org/blog/2023/06/22/type-system-updates-research-dev/" rel="nofollow">Type system updates: moving from research into development - The Elixir programming language </a></p>
<p>There are still no typing syntax or changes to the language. <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"> And there is still a chance we won’t go forward with this. But this is a very exciting step for sure.</p>
</blockquote>
</aside> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="314619" 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/57">Post #56</a>
	                </div>
	            </div>
              <div id="likers-container-314619" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="314619"
                     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 #56"></div>
  </section>
</div>
    <div class="postbit" id="314629" data-post-id="314629">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yeah the changes discussed will be in elixir 1.17, which is at least 5 month or so out. Can use elixir main branch until then.</p> 
	            </div>

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