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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Right, I was thinking in terms of maintenance of the compiler itself. From an end-user perspective, I don’t really care if the language has this special syntax for struct updates. If I don’t like it I just won’t use it. But IIUC from the prior discussions in the GH issue that spawned this thread, the type checking on the struct update syntax is special-cased in the compiler itself. That’s what concerns me. But again, I’m not a compiler engineer, so only the Elixir core team can actually confirm or deny if this is really a problem for maintenance.</p>
<p>I just know that in the Typescript world, these kinds of early decisions didn’t cause problems until people started building very large enterprise apps. IIRC, Typescript has a three-pass type checker (don’t quote me on that), which is where a lot of this slowness comes from. Based on the prior discussions, I believe an additional pass was added to the compiler to accommodate that warning, so if that’s the only reason for that additional pass, I think it should be removed. <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="378106" 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/changes-to-the-struct-update-syntax/71232/69">Post #68</a>
	                </div>
	            </div>
              <div id="likers-container-378106" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="378106"
                     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 #68"></div>
  </section>
</div>
    <div class="postbit" id="378145" data-post-id="378145">
  <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
                    <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 class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>For what is worth, implementing it was straightforward. The syntax will likely stay with the warnings that are currently on v1.19 (unless new challenges or trade-offs surface, but I don’t foresee any at the moment).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="378145" 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/changes-to-the-struct-update-syntax/71232/70">Post #69</a>
	                </div>
	            </div>
              <div id="likers-container-378145" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="378145"
                     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 #69"></div>
  </section>
</div>
    <div class="postbit" id="378146" data-post-id="378146">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Do you plan to add formatter or any other fixup tool to automatically fix it? Cause I’ve just tried 1.19-rc and I got many many many screens of warnings in every dependency and the host project. This looks like a lot of manual work for someone who has pipelines with <code>--warnings-as-errors</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="378146" 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/changes-to-the-struct-update-syntax/71232/71">Post #70</a>
	                </div>
	            </div>
              <div id="likers-container-378146" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="378146"
                     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 #70"></div>
  </section>
</div>
    <div class="postbit" id="378147" data-post-id="378147">
  <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
                    <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 class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>The RC emitted a different warning. So check latest. I also think styler may have added an automatic fix for this.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="378147" 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/changes-to-the-struct-update-syntax/71232/72">Post #71</a>
	                </div>
	            </div>
              <div id="likers-container-378147" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="378147"
                     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 #71"></div>
  </section>
</div>
    <div class="postbit" id="378173" data-post-id="378173">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="onebox allowlistedgeneric" data-onebox-src="https://styler.hexdocs.pm/deprecations.html">
  <header class="source">

      <a href="https://styler.hexdocs.pm/deprecations.html" target="_blank" rel="noopener nofollow ugc">styler.hexdocs.pm</a>
  </header>

  <article class="onebox-body">
    

<h3><a href="https://styler.hexdocs.pm/deprecations.html" target="_blank" rel="noopener nofollow ugc">Deprecated Elixirisms — Styler v1.11.0</a></h3>



  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>Styler has added a semi-manual solution, where it translates the <code>%User{user | name: ""}</code> to <code>%{user | name: ""}</code>, but it does not add the matching in the arguments, which, if not followed up by manual changes, makes the code worse than it used to be.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="378173" 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/changes-to-the-struct-update-syntax/71232/73">Post #72</a>
	                </div>
	            </div>
              <div id="likers-container-378173" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="378173"
                     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 #72"></div>
  </section>
</div>
    <div class="postbit" id="378176" data-post-id="378176">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Awesome! Thanks for confirming and for putting in the work!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="378176" 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/changes-to-the-struct-update-syntax/71232/74">Post #73</a>
	                </div>
	            </div>
              <div id="likers-container-378176" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="378176"
                     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 #73"></div>
  </section>
</div>
    <div class="postbit" id="378179" data-post-id="378179">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>That fix would be safe for any uses of the struct update syntax that aren’t generating the warning about a missing match, but it seems like an automatic fix for the type safety warning would be really hard. There are a lot of different ways that the variable could have been declared, and adding pattern matching can easily cause a line to exceed the line limit moving all the other code around, which might not be automatically reversible with the formatter, so this is one of the situations where Elixir’s one-way formatter changes will bite hard.</p>
<p>The most reliable fix would probably be to rebind the <code>user</code> variable right above the update line like:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">%User{} = user
%{user | name: ""}
</code></pre>
<p>But that would probably piss me off if I saw it all over my code. Seems like manual intervention is the best approach. Vim macros to the rescue again. <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>That being said, this would be really painful for a warnings-as-errors toolchain. <a class="mention" href="/u/josevalim" rel="nofollow">@josevalim</a> I found this old thread about disabling specific warnings <a href="https://groups.google.com/g/elixir-lang-core/c/QD3uG7WxZlM/m/Qh-CbD6fAAAJ" rel="noopener nofollow ugc">https://groups.google.com/g/elixir-lang-core/c/QD3uG7WxZlM/m/Qh-CbD6fAAAJ</a>, which would resolve the pain point most people in this thread have expressed around this update. Even if the team fixed all the warnings in their own code, having hundreds of these warnings from deps that might require devops support and a security review to update in a large org would be really painful. Is it still a firm “no” from the core team to be able to suppress specific warnings in the compiler flags?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="378179" 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/changes-to-the-struct-update-syntax/71232/75">Post #74</a>
	                </div>
	            </div>
              <div id="likers-container-378179" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="378179"
                     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 #74"></div>
  </section>
</div>
    <div class="postbit" id="378180" data-post-id="378180">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Actually, thinking about the formatter fix a bit more, this might work:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">%User{user | name: ""}
</code></pre>
<p>to</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">%{%User{} = user | name: ""}
</code></pre>
<p>Which feels cursed to me, but would probably be easy to grep for to update later on?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="378180" 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/changes-to-the-struct-update-syntax/71232/76">Post #75</a>
	                </div>
	            </div>
              <div id="likers-container-378180" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="378180"
                     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 #75"></div>
  </section>
</div>
    <div class="postbit" id="378201" data-post-id="378201">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="tfwright" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tfwright/120/20299_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  tfwright
                  </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="70" data-topic="71232">
<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>The syntax will likely stay with the warnings that are currently on v1.19</p>
</blockquote>
</aside>
<p>Does this mean the warning reported here and the explanation of it is accurate? <a href="https://forum.elixirforum.com/t/warning-about-missing-pattern-match-despite-pattern-matching/73273/11" class="inline-onebox" rel="nofollow">Warning about missing pattern match, despite pattern matching - #11 by garrison</a></p>
<p>i.e. using the old update syntax will generate a warning regardless of pattern matching? Or is there a pattern match error there those of us in that thread are missing? Because if it’s the former I will do as it sounds like others have done and deprecate that syntax now before I even try to update to 1.19</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="378201" 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/changes-to-the-struct-update-syntax/71232/77">Post #76</a>
	                </div>
	            </div>
              <div id="likers-container-378201" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="378201"
                     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 #76"></div>
  </section>
</div>
    <div class="postbit" id="383230" data-post-id="383230">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi!</p>
<p>Been testing the “new” syntax for a while now and I definitely feel like I am loosing some sense of overview.<br>
Using the %Struct{var | key: value} gave me immediate information about what was going to happen.</p>
<p>A simple example would be something like this</p>
<p>“Old way”</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def myfunc(%Struct1{} = arg1, %Struct2{} = arg2, %Struct3{} = arg3) do
  {%Struct1{arg1 | par1: :value1}, 
   %Struct2{arg2 | par2: :value2}, 
   %Struct3{arg3 | par3: :value3}}
end
</code></pre>
<p>Compared to the new way:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def myfunc(%Struct1{} = arg1, %Struct2{} = arg2, %Struct3{} = arg3) do
  {%{arg1 | par1: :value1}, 
   %{arg2 | par2: :value2}, 
   %{arg3 | par3: :value3}}
end
</code></pre>
<p>Just visually you loose the ability to see what struct is being updated and you have to follow the variable names backwards to infer the type, and more importantly you loose the visual aid, specially with syntax highlighting, that you are actually updating a struct and not any other map.</p>
<p>I would also imagine that this is also a harder problem for a LSP to figure out which struct it could provide auto-completion for as well?</p>
<p>In my opinion I would gladly wait couple more milliseconds/seconds for the compiler to verify the correctness of my keys if that is the downside of this approach.</p>
<p>Also, if the LSP together with the IDE could visually present the inferred type that would also satisfy my needs in this regard.</p>
<p>If the type checker would allow the usage of Struct update syntax if the variable used is already pattern matched that would also be great!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="383230" 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/changes-to-the-struct-update-syntax/71232/78">Post #77</a>
	                </div>
	            </div>
              <div id="likers-container-383230" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="383230"
                     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 #77"></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/71232/load_more?page=8">Load more posts (2 remaining)</a>
</div></template></turbo-stream>