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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>It is not the end of the world, but it can potentially make things harder.</p>
<p>As a ex-C++ developer, one of the things I appreciate the most about Elixir is its consistency. You have a really small set of rules and knowing them you are good, you can understand any elixir code.</p>
<p>I remember a project that I got in my first job as a Elixir developer, the guy that created the project wrote the code like it was imperative, the code was a mess and a lot of functions had more than 300 lines of code each (!).</p>
<p>But because Elixir rules are clear and we have immutability, even a code like that was still easy to read without having to have a lot of variables context in my mind.</p>
<p>Now I wonder how that code would look if we had this feature at the time, I’m pretty sure it would be way harder to reason about it.</p>
<p>But that’s just my opinion ofc.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310089" data-batch-url="/posts/batch_likers">
                        5
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/local-accumulators-for-cleaner-comprehensions/60130/83">Post #82</a>
	                </div>
	            </div>
              <div id="likers-container-310089" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310089"
                     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 #82"></div>
  </section>
</div>
    <div class="postbit" id="310090" data-post-id="310090">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>if I could have used @@… when I tried to grasp Elixir, I would have propably never understood what’s so positive about immutability.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310090" data-batch-url="/posts/batch_likers">
                        9
                      </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/local-accumulators-for-cleaner-comprehensions/60130/84">Post #83</a>
	                </div>
	            </div>
              <div id="likers-container-310090" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310090"
                     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 #83"></div>
  </section>
</div>
    <div class="postbit" id="310094" data-post-id="310094">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I am against this proposal, due to the following:</p>
<ul>
<li>Personal opinion: I feel that Elixir already has too much syntax. There are many ways to accomplish the same things (<code>for</code> vs <code>Enum</code>, but there’s also <code>Map.new</code>; we have various syntax sugars for keyword lists and maps and their updates and accesses; sigils; three ways to do charlists; pattern matching in function heads vs <code>case</code> inside function; moving <code>catch</code> et al to the top level of functions vs inside functions) and to new users there is already a considerable amount to learn. Not to mention all the macros in Phoenix and other popular projects. Elixir should be striving for <em>less</em> syntax, not more.</li>
<li>Personal opinion: I do not like <code>@@</code>, <code>@</code> is already used for module attributes <em>and</em> EEx templates, and this will create confusion for new users.</li>
<li>Fear: This will confuse new users who already have a hard time with immutability, as they will expect it to do mutability the familiar way (and in some ways it does). Then they’ll try to extend that line of thinking and hit a wall where it won’t work anymore. In my opinion it would be better to teach them <em>one</em> way of working right away, instead of having to balance two ways. Eventually, as the user learns how immutability and scoping work, this syntax will be a burden as it now requires keeping in mind two different ways of working. And such a burden will be a burden forever, while learning new things is only a burden once.</li>
<li>Personal opinion: The solution to the original problem should be functions, not more special syntax. The code being noisy should be a signal to the author to split parts off to small <code>defp</code>s to make it clearer. With that in mind, I don’t really agree with the initial premise of the proposal.</li>
</ul>
<aside class="quote group-Phoenix-Core-Team" data-username="jeregrine" data-post="64" data-topic="60130">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jeregrine/48/20546_2.png" class="avatar"> jeregrine:</div>
<blockquote>
<p>This change is relatively small in the grand scheme of things and will MOSTLY make things like Advent of Code and other learning problems easier to accomplish</p>
</blockquote>
</aside>
<p>We should definitely <em>not</em> add syntax to the language just to deal with Advent of Code and other nonrealistic coding challenges. All syntax is a burden, and I don’t see programming puzzles as a good enough reason to add more. There has to be additional impact. (This is only a response to the quoted part, not to the original post.)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310094" data-batch-url="/posts/batch_likers">
                        18
                      </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/local-accumulators-for-cleaner-comprehensions/60130/85">Post #84</a>
	                </div>
	            </div>
              <div id="likers-container-310094" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310094"
                     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 #84"></div>
  </section>
</div>
    <div class="postbit" id="310101" data-post-id="310101">
  <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>Not sure what to think about this. The only times I feel the need for something like this is when advent if code is active <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>
<p>Just make the syntax ugly enough so we wont be tempted to use it more than when absolutely necessary:)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310101" 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/local-accumulators-for-cleaner-comprehensions/60130/86">Post #85</a>
	                </div>
	            </div>
              <div id="likers-container-310101" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310101"
                     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 #85"></div>
  </section>
</div>
    <div class="postbit" id="310103" data-post-id="310103">
  <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">
								<aside class="quote no-group" data-username="hst337" data-post="80" data-topic="60130">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/h/41988e/48.png" class="avatar"> hst337:</div>
<blockquote>
<p>I have a question for you then: why do we need to teach newcomers to use <code>Enum</code> and semi-mutable variables in <code>for</code> and their bad practices, while we could only teach them <code>Enum</code>?</p>
</blockquote>
</aside>
<p>Because there is no monopoly or unified way in how we teach people the language, nor in how people learn. We can’t assume <code>Enum</code> will be taught and, even if it is, different people will take different amount of times to grasp it. Is it really worth saying: you will be unable to solve certain problems unless you fully grasp this concept, while elsewhere it is considerably easier to tackle it?</p>
<p>Look, I completely understand those who don’t like the solution, consider it may bloat the language, or don’t like the proposed syntax. But I was honestly hoping more empathy towards the problem statement. Telling people “oh, you can use map_reduce” to me is somewhat equivalent to the famous joke:</p>
<blockquote>
<p>A monad is just a monoid in the category of endofunctors, what’s the problem?</p>
</blockquote>
<p>It is not even about learning. There is one assumption and one personal preference here:</p>
<ol>
<li>I assume that something like local accumulators will provide several users a better on-boarding ramp</li>
<li>I personally prefer the Python (and other imperative language) solutions to this problem</li>
</ol>
<p>And this is not about Python. Pick any imperative language and their solution will be clearer. Python just happens to be the most concise one. As I said in the other thread, give any Elixir developer both the Python and the Elixir solution, and I believe the majority will most likely understand what is happening on the Python one in less time, because of the amount of boilerplate in the Elixir one.</p>
<p>There is a meme that is applicable here. Some of you may have seen a slide about design patterns in OO and FP languages:</p>
<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/3X/a/0/a00d4e3410a5f271df23747286645a81c661bf52.jpeg" data-download-href="https://forum.elixirforum.com/uploads/default/a00d4e3410a5f271df23747286645a81c661bf52" title="image" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/original/3X/a/0/a00d4e3410a5f271df23747286645a81c661bf52.jpeg" alt="image" data-base62-sha1="mPSTVO8z6YkP3kubiKih6OfNHXQ" width="690" height="410" data-dominant-color="EDEEED"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">932×554 35.2 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p>Yet we have this here:</p>
<div class="md-table">
<table>
<thead>
<tr>
<th>FP</th>
<th>Imperative</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>map</code></td>
<td>loop</td>
</tr>
<tr>
<td><code>reduce</code></td>
<td>loop</td>
</tr>
<tr>
<td><code>flat_map</code></td>
<td>loop</td>
</tr>
<tr>
<td><code>flat_map_reduce</code></td>
<td>loop</td>
</tr>
<tr>
<td><code>scan</code></td>
<td>loop</td>
</tr>
<tr>
<td><code>count_by</code></td>
<td>Oh my, loop</td>
</tr>
<tr>
<td><code>count_until</code></td>
<td>loop+break</td>
</tr>
<tr>
<td><code>take_while</code></td>
<td>loop+break</td>
</tr>
<tr>
<td><code>split_while</code></td>
<td>loop+break</td>
</tr>
<tr>
<td><code>drop_while</code></td>
<td>loop+break</td>
</tr>
<tr>
<td><code>reduce_while</code></td>
<td>loop+break</td>
</tr>
<tr>
<td>…</td>
<td>…</td>
</tr>
</tbody>
</table>
</div><p>And it goes on and on.</p>
<p>Look, I love the <code>Enum</code> module. It provides a great shared vocabulary. But we need to acknowledge it is a sizeable step in our learning curve. Once again, I don’t think it means we need to accept this, but I do think the status quo can be improved considerably.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310103" data-batch-url="/posts/batch_likers">
                        31
                      </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/local-accumulators-for-cleaner-comprehensions/60130/87">Post #86</a>
	                </div>
	            </div>
              <div id="likers-container-310103" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310103"
                     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 #86"></div>
  </section>
</div>
    <div class="postbit" id="310105" data-post-id="310105">
  <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">
								<aside class="quote no-group" data-username="Nicd" data-post="85" data-topic="60130">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/nicd/48/2357_2.png" class="avatar"> Nicd:</div>
<blockquote>
<p>Elixir should be striving for <em>less</em> syntax, not more.</p>
</blockquote>
</aside>
<p>You are right and this has effectively turned me off this proposal. We have considerably less syntax than the other languages mentioned here (Python, JS, etc) but the syntax is also different and part of the learning curve. Those learning get confused with <code>if true do ... end</code> vs <code>if true, do: ...</code> and I can see this adding to the same style of confusion.</p>
<p>Perhaps the option is to either introduce <code>accum session_counter = 0</code> (similar to the previous one by using another keyword) or introduce a new block construct  <code>accumulate session_counter &lt;- 0, lesson_counter &lt;- 0 do</code>.</p>
<p>I believe we are making progress… it just takes a while. <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="310105" data-batch-url="/posts/batch_likers">
                        22
                      </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/local-accumulators-for-cleaner-comprehensions/60130/88">Post #87</a>
	                </div>
	            </div>
              <div id="likers-container-310105" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310105"
                     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 #87"></div>
  </section>
</div>
    <div class="postbit" id="310109" data-post-id="310109">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="hst337" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  hst337
                  </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="87" data-topic="60130">
<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>I assume that something like local accumulators will provide several users a better on-boarding ramp</p>
</blockquote>
</aside>
<p>That’s a great goal. But as I’ve described, this solution won’t make it easier for Python devs to onboard, because it won’t behave like mutable variable in any sense. It will just mislead them into thinking that it is, and then they’ll learn on their mistakes that it is actually not. (this is a counterargument based on my detailed explanations in previous post)</p>
<hr>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="87" data-topic="60130">
<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>Because there is no monopoly or unified way in how we teach people the language, nor in how people learn. We can’t assume <code>Enum</code> will be taught and, even if it is, different people will take different amount of times to grasp it</p>
</blockquote>
</aside>
<p>Most likely it will be taught. Elixir is a mature language with mature ecosystem. Every new-to-the-language developer will occasionally come across the old code with <code>Enum</code>, and every developer will have to learn what <code>Enum</code> does and how to use it. (it is my strong opinion and I think that it can be perceived as a fact).</p>
<hr>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="87" data-topic="60130">
<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>But I was honestly hoping more empathy towards the problem statement. Telling people “oh, you can use map_reduce”</p>
</blockquote>
</aside>
<p>I feel it, and I agree that Python has cleaner solution. But it is clearly a tradeoff. Python has clean solutions for AoC because of mutability, and Elixir has codebases which are easier to maintain because of immutability. And the proposed solution with local semi-mutability will bring confusion for both Python and Elixir devs, since it has nothing to do with mutability and it has really strange runtime implications. (this is a counterargument based on my detailed explanations in previous post)</p>
<hr>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="87" data-topic="60130">
<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>Look, I love the <code>Enum</code> module. It provides a great shared vocabulary. But we need to acknowledge it is a sizeable step in our learning curve. Once again, I don’t think it means we need to accept this, but I do think the status quo can be improved considerably.</p>
</blockquote>
</aside>
<p>Yes, I agree. But in the end, these implications bring more good than bad. The feature you’re suggesting will lead to incorrect understanding of the performance and how it actually works, which will lead to wrong (in my example with loop+break) or inefficient (in my final example) code. (here I just restated my points about this proposals lowering the learning curve)</p>
<p>And as I’ve stated before, developers would still have to learn how <code>Enum</code> works, since it is present in literally every Elixir project. (it is a fact). So you’re not suggesting learning <code>for</code> with accumulators instead of <code>Enum</code>, you’re actually suggesting learning <code>for</code> with accumulators <strong>and</strong> <code>Enum</code>. (this is a conclusion)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310109" 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/local-accumulators-for-cleaner-comprehensions/60130/89">Post #88</a>
	                </div>
	            </div>
              <div id="likers-container-310109" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310109"
                     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 #88"></div>
  </section>
</div>
    <div class="postbit" id="310110" data-post-id="310110">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I feel that no matter where we go with this proposal we will always have people in favor and people against it (same as before) so don’t sweat over it.</p>
<p>That being said, I still do think that we landed in a better position with this proposal (with the current syntax) than the others before it. I personally still think that something like <code>@@acc</code> deviates a lot less from standard language constructs than <code>accumm acc</code> or <code>mut acc</code> and would cause less confusion.</p>
<p>To me at least, it looks a little bit like some kind of special one-way message passing and kinda reminds me of Svelte’s <code>$</code> variables, but I totally understand why some people are getting hung up on the idea of mutability… And now I’ll be forever curious what other use cases we would have made possible by allowing this (especially in Phoenix/LiveView <img src="https://forum.elixirforum.com/images/emoji/apple/eyes.png?v=15" title=":eyes:" class="emoji" alt=":eyes:" loading="lazy" width="20" height="20">).</p>
<aside class="quote group-Membrane-Core-Team" data-username="mat-hek" data-post="49" data-topic="60130">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mat-hek/48/38168_2.png" class="avatar"> mat-hek:</div>
<blockquote>
<p>No idea if this was already proposed, but the problem with explicit <code>else</code> could be solved with a dedicated ‘conditional assignment’ syntax, for example</p>
<hr>
<pre data-code-wrap="elixir"><code class="lang-elixir">x = 4 if a &gt; 10
</code></pre>
</blockquote>
</aside>
<p>I was re-reading the thread and saw this and wanted to acknowledge how beautiful this looks… I have never worked with Ruby professionally, but I do love its expressiveness. If this were possible in Elixir as well it would be <img src="https://forum.elixirforum.com/images/emoji/apple/fire.png?v=15" title=":fire:" class="emoji" alt=":fire:" loading="lazy" width="20" height="20"> haha.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310110" data-batch-url="/posts/batch_likers">
                        5
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/local-accumulators-for-cleaner-comprehensions/60130/90">Post #89</a>
	                </div>
	            </div>
              <div id="likers-container-310110" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310110"
                     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 #89"></div>
  </section>
</div>
    <div class="postbit" id="310111" data-post-id="310111">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>What about an extension to <code>for</code> instead like Greg suggested (or maybe I misunderstood)?</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">list = [1, 2]
for val &lt;- list, binding: [a: 0, b: 1] do
  a = a + val
  b = b + val
end

$ Kernel.binding()
# =&gt; [a: 3, b: 4]
</code></pre>
<p>Something along that line, makes it look less like a mutable variable?</p>
<p>EDIT: edited to make it more obvious that it’s accumulating values</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310111" 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/local-accumulators-for-cleaner-comprehensions/60130/91">Post #90</a>
	                </div>
	            </div>
              <div id="likers-container-310111" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310111"
                     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 #90"></div>
  </section>
</div>
    <div class="postbit" id="310112" data-post-id="310112">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I haven’t been able to read all of the thread/s so apologise in advance if this is no longer possible or has since been agreed not to pursue (feel free to ignore this comment in that case) but just want to comment on this from the original thread:</p>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="27" data-topic="60093">
<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"><a href="https://forum.elixirforum.com/t/koka-inspired-local-mutable-variables-for-cleaner-comprehensions/60093/27" rel="nofollow">Koka-inspired local mutable variables for cleaner comprehensions</a></div>
<blockquote>
<p>We definitely need explicit syntax to declare them, such as the <code>mut</code> “keyword”, do we also need explicit syntax to reassign them? I am personally undecided.</p>
</blockquote>
</aside>
<p>I personally liked José’s original proposal without the explicit syntax as it’s the least jarring and looks the cleanest and easiest to read to me:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">mut section_counter = 0
mut lesson_counter = 0

for section &lt;- sections do
  if section["reset_lesson_position"] do
    lesson_counter = 0
  end

  section_counter = section_counter + 1

  lessons =
    for lesson &lt;- section["lessons"] do
      lesson_counter = lesson_counter + 1
      Map.put(lesson, "position", lesson_counter)
    end

  section
  |&gt; Map.put("lessons", lessons)
  |&gt; Map.put("position", section_counter)
end

</code></pre>
<p>It also let’s people use their own signifier:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">mut m_section_counter = 0
mut m_lesson_counter = 0

for section &lt;- sections do
  if section["reset_lesson_position"] do
    m_lesson_counter = 0
  end

  m_section_counter = m_section_counter + 1

  lessons =
    for lesson &lt;- section["lessons"] do
      m_lesson_counter = m_lesson_counter + 1
      Map.put(lesson, "position", m_lesson_counter)
    end

  section
  |&gt; Map.put("lessons", lessons)
  |&gt; Map.put("position", m_section_counter)
end

</code></pre>
<p>or:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">mut acc_section_counter = 0
mut acc_lesson_counter = 0

for section &lt;- sections do
  if section["reset_lesson_position"] do
    acc_lesson_counter = 0
  end

  acc_section_counter = acc_section_counter + 1

  lessons =
    for lesson &lt;- section["lessons"] do
      acc_lesson_counter = acc_lesson_counter + 1
      Map.put(lesson, "position", acc_lesson_counter)
    end

  section
  |&gt; Map.put("lessons", lessons)
  |&gt; Map.put("position", acc_section_counter)
end

</code></pre>
<p>Personally I would use the original. Declaring them, and seeing how they’re used in code is enough for me to differentiate them.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="310112" 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/local-accumulators-for-cleaner-comprehensions/60130/92">Post #91</a>
	                </div>
	            </div>
              <div id="likers-container-310112" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="310112"
                     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 #91"></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/60130/load_more?page=10">Load more posts (155 remaining)</a>
</div></template></turbo-stream>