<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="309667" data-post-id="309667">
  <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">
								<p>I don’t really like introducing general mutability within functions, as others have already said, it creates the issue of “elixir is immutable <em>except</em>…”</p>
<p>Would it instead be possible to introduce some kind of “pinning operator” for comprehensions so that within the scope of the comprehension any assignment/binding of values is actually binding the variable on the outer scope, rather than wholesale mutability within functions?</p>
<p>Thinking out loud:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">section_counter = 0
lesson_counter = 0

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

  section_counter = section_counter + 1

  lessons =
    for lesson &lt;- section["lessons"], ^lesson_counter 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> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="309667" 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/koka-inspired-local-mutable-variables-for-cleaner-comprehensions/60093/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-309667" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="309667"
                     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 #11"></div>
  </section>
</div>
    <div class="postbit" id="309674" data-post-id="309674">
  <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>Very interesting idea you have there… This always reminds me of the usage of <code>^</code> within Ecto queries. The problem I have with syntax changes is when we have different meanings for different contexts, so would be nice if we could create a consistent meaning for the usage of this operator (and it seems we already assign this meaning to it like you suggested, <a href="https://forum.elixirforum.com/t/ecto-the-pin-operator/1101/3" rel="nofollow">see here</a>.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="309674" 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/koka-inspired-local-mutable-variables-for-cleaner-comprehensions/60093/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-309674" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="309674"
                     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 #12"></div>
  </section>
</div>
    <div class="postbit" id="309679" data-post-id="309679">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mudasobwa" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mudasobwa/120/5298_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mudasobwa
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Cure</span>
			          </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="1" 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"> josevalim:</div>
<blockquote>
<p>Unfortunately, there is no mechanism to write this using for-comprehensions in Elixir.</p>
</blockquote>
</aside>
<p>Well, this particular example can be easily written with <code>:reduce</code></p>
<pre data-code-wrap="elixir"><code class="lang-elixir">{list, sum} =
  for elem &lt;- [1, 2, 3], reduce: {[], 0},
    do: ({list, sum} -&gt; {[elem*2|list], elem+sum})
#⇒ {[6, 4, 2], 6}
</code></pre>
<p>The counter within a nested “loop” might be (arguably not elegant) achieved by wrapping the outer enumerable into <code>Enum.with_index/1</code> <em>and</em> keeping this index in the accumulator given <code>reset_lesson_position = index == current_index</code>.</p>
<p>That said, I frankly do not see any noticeable advantage to be traded for breaking one of the main principles of the languages. Even rebinding gave birth to the countless number of discussions, this one would spread the whole picture for newcomers even more. Maybe it’s just me, but I find immutability nice even though sometimes one cannot write a pythonesque code with it.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="309679" 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/koka-inspired-local-mutable-variables-for-cleaner-comprehensions/60093/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-309679" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="309679"
                     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 #13"></div>
  </section>
</div>
    <div class="postbit" id="309685" data-post-id="309685">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I feel that a more realistic pain point should be demonstrated before the language gains scoped mutability (which will only add confusion as others have said and I agree).</p>
<p>That immutability makes certain algorithms impractical is known and somewhat accepted but I’d think this is solved by having Erlang BIFs and C / C++ / Rust / Zig NIFs.</p>
<p>IMO not worth it, it will confuse people for a benefit that’s not well advocated for.</p>
<p>Can we get an example that demonstrates the need for this feature i.e. “this crucially important Elixir code would be forever needlessly slow if we don’t do 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="309685" data-batch-url="/posts/batch_likers">
                        10
                      </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/koka-inspired-local-mutable-variables-for-cleaner-comprehensions/60093/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-309685" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="309685"
                     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 #14"></div>
  </section>
</div>
    <div class="postbit" id="309695" data-post-id="309695">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>The other points are valid but I personally like it. I’ve had to reduce over nested structures over the past year and the readability still hasn’t really become second nature.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="309695" 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/koka-inspired-local-mutable-variables-for-cleaner-comprehensions/60093/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-309695" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="309695"
                     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 #15"></div>
  </section>
</div>
    <div class="postbit" id="309703" data-post-id="309703">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi,<br>
I agree with the idea of having a temporal state for comprehensions; it helps to express the solution more clearly. However, having another thing to consider when we code doesn’t sound very nice. Also, it can be difficult to trace the absence of the keyword.</p>
<p>What if we can express the same idea (temporal state for comprehensions) without introducing new keywords?</p>
<p>for example, something like</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">for section &lt;- sections, state: {lesson_counter \\ 0, section_counter \\ 0} 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 = section
  |&gt; Map.put("lessons", lessons)
  |&gt; Map.put("position", section_counter)
  
  {:next, section, {lesson_counter, section_counter}}
end
</code></pre>
<p>or maybe something like <code>quote</code></p>
<pre data-code-wrap="elixir"><code class="lang-elixir">for section &lt;- sections, state: [lesson_counter: 0, section_counter: 0] 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> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="309703" 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/koka-inspired-local-mutable-variables-for-cleaner-comprehensions/60093/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-309703" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="309703"
                     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 #16"></div>
  </section>
</div>
    <div class="postbit" id="309707" data-post-id="309707">
  <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="al2o3cr" data-post="10" 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/al2o3cr/48/3457_2.png" class="avatar"> al2o3cr:</div>
<blockquote>
<p>I’m interested by the idea, but I suspect that this restriction (sensible though it is) would be a support headache.</p>
</blockquote>
</aside>
<p>I am not worried about people reassigning inside an anonymous function being a support headache because we will explicitly raise a clear error message. I’d say it would even lead to a better user experience than regular variables today, because we can detect it and explain why it is not possible.</p>
<aside class="quote no-group" data-username="dimitarvp" data-post="15" 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/dimitarvp/48/38664_2.png" class="avatar"> dimitarvp:</div>
<blockquote>
<p>Can we get an example that demonstrates the need for this feature i.e. “this crucially important Elixir code would be forever needlessly slow if we don’t do this”?</p>
</blockquote>
</aside>
<p>Because we still compile to immutable code, there is no such example. This is purely a syntactical construct with no runtime changes. So in a way, the name proposed here is actually very misleading, because we don’t actually have mutability.</p>
<p>Perhaps a better comparison would be to JavaScript: consider that all variables in Elixir are defined with <code>let</code> and here we are defining them with <code>var</code> (actually, a limited form of <code>var</code>). Another name we could give to this is “local accumulators”. Perhaps it would be more generally acceptable if we don’t include the name “mutable” in them (as they aren’t mutable).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="309707" 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/koka-inspired-local-mutable-variables-for-cleaner-comprehensions/60093/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-309707" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="309707"
                     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 #18"></div>
  </section>
</div>
    <div class="postbit" id="309709" data-post-id="309709">
  <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>heavy-plus-sign emoji to “local accumulators” terminology.</p>
<p>I know you don’t want to talk about syntax but I do like where <a class="mention" href="/u/adw632" rel="nofollow">@adw632</a> is going with the “pinning” idea.  This way you wouldn’t have to “open” a scope to all of its descendants.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">list = []

if true, ^list, do: [:ok | list]

if true, do: [:not_ok | list] # error
</code></pre>
<p>EDIT: You probably get this spirit of this but of course the second <code>if</code> wouldn’t be an error, it just wouldn’t “mutate” the outer <code>list</code> binding.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="309709" 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/koka-inspired-local-mutable-variables-for-cleaner-comprehensions/60093/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-309709" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="309709"
                     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 #19"></div>
  </section>
</div>
    <div class="postbit" id="309710" data-post-id="309710">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </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="1" 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"> josevalim:</div>
<blockquote>
<p>You can mutate them inside <code>if</code>/<code>unless</code>, <code>for</code> comprehensions, <code>cond</code>, <code>receive</code>… but that’s all.</p>
</blockquote>
</aside>
<p><img src="https://forum.elixirforum.com/images/emoji/apple/-1.png?v=15" title=":-1:" class="emoji" alt=":-1:" loading="lazy" width="20" height="20"> if that would work only for those as in that case I would expect to see a new operator which would be part of those constructs instead. I simply don’t like that <code>mut variable</code> is called outside of said <code>for</code> definition which allows people to put between them many lines unrelated to said variable.</p>
<p><img src="https://forum.elixirforum.com/images/emoji/apple/+1.png?v=15" title=":+1:" class="emoji" alt=":+1:" loading="lazy" width="20" height="20"> with that type of syntax if it would work within all code blocks (<code>do</code>, <code>else</code>, <code>after</code> and so on …). First of all this makes it simpler to remember comparing to some list of constructs. Secondly it would allow to write a custom macros with <code>do … end</code> blocks.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="309710" 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/koka-inspired-local-mutable-variables-for-cleaner-comprehensions/60093/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-309710" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="309710"
                     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 #20"></div>
  </section>
</div>
    <div class="postbit" id="309711" data-post-id="309711">
  <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="Eiji" data-post="21" 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/eiji/48/36743_2.png" class="avatar"> Eiji:</div>
<blockquote>
<p><img src="https://forum.elixirforum.com/images/emoji/apple/+1.png?v=15" title=":+1:" class="emoji" alt=":+1:" loading="lazy" width="20" height="20"> with that type of syntax if it would work within all code blocks (<code>do</code>, <code>else</code>, <code>after</code> and so on …). First of all this makes it simpler to remember comparing to some list of constructs. Secondly it would allow to write a custom macros with <code>do … end</code> blocks.</p>
</blockquote>
</aside>
<p>It would work for all code-blocks, hence the <code>...</code> in the original description, (and all macro <code>do-end</code>s as long as they compile to one of Elixir’s code blocks too), but it won’t work across functions (anonymous or otherwise) or modules.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="309711" 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/koka-inspired-local-mutable-variables-for-cleaner-comprehensions/60093/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-309711" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="309711"
                     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>
</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/60093/load_more?page=3">Load more posts (50 remaining)</a>
</div></template></turbo-stream>