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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>In Elixir, a variable <strong>identifier</strong> is mutable, but the <strong>value</strong> it holds is immutable.</p>
<p>In JavaScript, <code>const</code> makes a variable <strong>identifier</strong> immutable, but its <strong>value</strong> is still mutable.</p>
<pre data-code-wrap="javascript"><code class="lang-javascript">const foo = {};
foo = { reassign: 'me' }; // fails
foo.mutate = 'me';        // succeeds
</code></pre>
<p>In computer science, <em>variable</em> refers to its <strong>value</strong> (see <a href="https://en.wikipedia.org/wiki/Variable_(computer_science)#Identifiers_referencing_a_variable" rel="noopener nofollow ugc"> Wikipedia</a>). Therefore, Elixir variables are immutable.</p>
<p>Hope you like my fancy explanation!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="155947" 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/immutability-explanation/27746/32">Post #31</a>
	                </div>
	            </div>
              <div id="likers-container-155947" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="155947"
                     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 #31"></div>
  </section>
</div>
    <div class="postbit" id="155984" data-post-id="155984">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="jslearner" data-post="31" data-topic="27746">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/j/858c86/48.png" class="avatar"> jslearner:</div>
<blockquote>
<p>Elixir has immutability only with regards to lexical scoping, it helps in concurrency.</p>
</blockquote>
</aside>
<p>Not sure about that, the VM does not provide a way to mutate values afaik, immutability is also enforced at the implementation level, not only because of lexical scoping rules.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="155984" 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/immutability-explanation/27746/33">Post #32</a>
	                </div>
	            </div>
              <div id="likers-container-155984" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="155984"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>