<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="2501" data-post-id="2501">
  <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">
								<aside class="quote group-Erlang-Core-Team" data-username="rvirding" data-post="10" data-topic="253">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/rvirding/48/1409_2.png" class="avatar"> rvirding:</div>
<blockquote>
<p>These are of course all my views, and I know many will not agree with me.</p>
</blockquote>
</aside>
<p>Thanks for the post Robert - it’s good to hear a variety of views on the topic and I am sure many people will find your post very interesting.</p>
<p><em>Btw, in case others haven’t twigged yet, <a class="mention" href="/u/rvirding" rel="nofollow">@rvirding</a> is Robert Virding, one of the creators of Erlang <img src="https://forum.elixirforum.com/uploads/default/original/2X/6/6c3193d1dd46244da3c8c6f719c9f5e2abdd5ae8.gif?v=15" title=":003:" class="emoji emoji-custom" alt=":003:" loading="lazy" width="20" height="20"></em></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="2501" 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/benefits-of-elixir-over-erlang/253/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-2501" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="2501"
                     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="2504" data-post-id="2504">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I find the real power of using binaries for strings in pattern matching.<br>
It’s very easy to distinguish a list of strings from a string, while with<br>
charlists it’s rather difficult.</p>
<p>I admit that the syntax of Erlang is extremely simple and quite easy to<br>
pick up (besides punctuation). There’s always the trade-off of<br>
expressiveness vs simplicity, and I feel like which one is better is a<br>
question of personal preference more than anything else.</p>
<p>I also agree with Robert, that macros are a great feature you can easily<br>
use to shoot yourself not just in the foot, but straight in the face. And<br>
unfortunately I see many libraries in Elixir that heavily overuse macros<br>
for things that could be easily solved with regular functions. That happens<br>
especially frequent with the <code>use</code> syntax that is often used to simulate<br>
inheritance (in terms of OO). It’s important to remember the first rule of<br>
the macro club: “Don’t write macros!” (not sure where that originated).</p>
<p>I’m surprised nobody mentioned protocols yet. To me it’s a very important<br>
feature especially when it comes down to encoding/decoding between formats.<br>
I find it quite powerful that I can define how to convert something to JSON<br>
or that I can call the JSON encode function and not care what data do I<br>
get. It’s a perfect example of extensibility of code for changing<br>
circumstances - one part of the system only knows it deals with something<br>
that can be encoded to JSON, what it is exactly and how to encode it is<br>
maintained elsewhere.</p>
<p>Another feature of Elixir that was mentioned very briefly is the<br>
consistency of standard library. While I understand the reasons why<br>
Erlang’s stdlib is not consistent (backwards compatibility and stuff), it’s<br>
still a great thing that all the collections have a <code>put/3</code> function to<br>
insert data or <code>delete/2</code> to remove and that the order of arguments is<br>
exactly the same. Or that predicates for use in guards are called<br>
<code>is_something</code> and those that can’t be used in guards are called<br>
<code>something?</code>.</p>
<p>To sum it up: whether it’s Elixir, Erlang or LFE I think that the more<br>
people use either one, the more we all benefit, be it by the common<br>
libraries we all use or the increased “recognizability” of the platform. We<br>
shouldn’t strive to isolate those communities from one another, but to<br>
bring them closer and encourage the exchange of ideas.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="2504" data-batch-url="/posts/batch_likers">
                        13
                      </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/benefits-of-elixir-over-erlang/253/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-2504" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="2504"
                     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="2506" data-post-id="2506">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="rvirding" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/rvirding/120/1409_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  rvirding
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Erlang</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Let’s see if this reply works as I hope, first time.</p>
<p>Oh yes, there are many issues in choosing a good data representation. My point was just that saying that binary strings are better is not really saying very much.</p>
<p>As you point out binary strings generally use less memory than list strings: 1-4 bytes per character for binary strings vs 2 words per character for the list strings. However list strings are often faster as there is less copying and lists are optimally implemented.</p>
<p>If you are working with UTF-8 encoded characters then random access doesn’t work with either representation.</p>
<p>In both cases on the erlang-VM you are basing them on another datatype, lists or binaries, to implement them so it can be ambiguous what your data actually is. In the erlang shell lists of integers which can be strings are printed as strings even if that is not the intent. In elixir binaries which could be UTF-8 strings are printed as strings. Often this is correct but sometimes it can confusion. Try doing [97,97,99] in the erlang shell and &lt;&lt;97,98,99&gt;&gt; in the elixir shell. There is no way around this.</p>
<p>Probably the best way is to mix implementations: use lists for the string parts you work on and binaries for the rest. But there is no built in support for this.</p>
<p>In erlang we chose lists as this was a common way of doing it in the functional world while I guess José chose binaries as this was closer to what Ruby and other languages do.</p>
<p>It boils down to choices. “Pest eller cholera” as the swedish saying goes.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="2506" 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/benefits-of-elixir-over-erlang/253/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-2506" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="2506"
                     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="2507" data-post-id="2507">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="rvirding" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/rvirding/120/1409_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  rvirding
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Erlang</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hehehe, another rule on macros I have heard is “Don’t use a macro when you can use a function”. <img src="https://forum.elixirforum.com/images/emoji/apple/grinning.png?v=15" title=":grinning:" class="emoji" alt=":grinning:" loading="lazy" width="20" height="20"></p>
<p>Yes, the libraries are a problem. People complain, quite rightly, that they are inconsistent but if we then say “ok, we will fix them” they complain even more. And doing things like having new versions, for example <code>lists2</code>, is even worse. This I am a bit jealous that elixir could do that.</p>
<p>We have occasionally had these OO drives for erlang as well but they have usually gone away after a while. Although we had an experimental parametrised modules for a few versions which was very OOish.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="2507" data-batch-url="/posts/batch_likers">
                        6
                      </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/benefits-of-elixir-over-erlang/253/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-2507" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="2507"
                     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>