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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="terakilobyte" data-post="31" data-topic="2303">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/terakilobyte/48/1681_2.png" class="avatar"> terakilobyte:</div>
<blockquote>
<p>I either filter down or use List.first/1 or List.last/1</p>
</blockquote>
</aside>
<p>I usually pattern match myself, consider these two cases:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">myVar = someFunction("blah")

# Case 1
first = List.first(myVar)

# Case 2
[first|_] = myVar

# Case 3
case myVar do
  [first|_] -&gt; useFirst(first)
  [] -&gt; doOtherwise()
end
</code></pre>
<p>Case 1 is using List.first, it works.<br>
Case 2 is pattern matching, same as Case 1 but I like it as it makes it explicit what it is doing.<br>
Case 3 is a case statement, longer sure, but the usage of the match is handled and if the list is empty that is also handled.</p>
<p>However, what if <code>myVar</code> was <code>nil</code>?  Maybe even through no fault of <code>someFunction/1</code> but rather some other call or so.  Cases 1 and 2 and 3 all crash.</p>
<p>A statically typed system on the other hand <em>has</em> to know what is returned, like given this equivalent OCaml code:</p>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">let myVar = someFunction "blah" in

(* Case 1 *)
let first = List.hd myVar in

(* Case 2 *)
let first::_ = myVar in

(* Case 3 *)
match myVar with
| first::_ -&gt; useFirst first
| [] -&gt; doOtherwise ()
</code></pre>
<p>Given <code>someFunction "blah"</code> can only return a list (otherwise it throws an exception if an exceptional condition):</p>
<ul>
<li>Case 1 → Compiles and works as expected, returns first as <code>first</code> else throws an exception.</li>
<li>Case 2 → Compiles and works as expected, returns first as <code>first</code> else throws an exception.</li>
<li>Case 3 → Compiles and works as expected, you handle all paths.</li>
</ul>
<p>However, given <code>someFunction "blah"</code> can return a list or <code>()</code> (Ocaml’s version of <code>nil</code>) as a <code>Result.t</code> or just an <code>option</code>, say because of an internal refactor later on in the project and the above original code was missed in the update, then:</p>
<ul>
<li>Case 1 → Will not compile, List.first only accepts a variable that can only be a nil</li>
<li>Case 2 → Will not compile, the match construct cannot match anything of myVar, have to decompose the option.</li>
<li>Case 3 → Will not compile, the match construct cannot match anything of myVar, have to decompose the option.</li>
</ul>
<p>You either have to <code>withDefault</code> the option/result to a default value to get back to the original handling, or you have to handle the option properly.  In either case in a dynamic language this is missed and will crash sometime later (hopefully in tests, most likely in prod, especially if the tests do not test a <code>nil</code> case because there was no <code>nil</code> case originally).  Dialyzer ‘might’ catch this if all paths can be confirmed, but that cannot be guaranteed.  <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="15706" 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/origin-of-the-name-elixir/2303/32">Post #31</a>
	                </div>
	            </div>
              <div id="likers-container-15706" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="15706"
                     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="16119" data-post-id="16119">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>It won’t come from here but somehow elixir reminds me of frobscottle, an invention from Roald Dahl.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">In The BFG, he describes frobscottle, a fizzy drink where 
the bubbles fizz downwards instead of up. Upward-fizzing bubbles 
make one burp, something the giants in the book find ‘filthsome’. 
Sophie, the heroine, takes issue with the alternative.

“With frobscottle,” Sophie said, “the bubbles in your tummy 
will be going downwards and that could have a far nastier 
result.”
“Why nasty?” asked the BFG, frowning.
“Because,” Sophie said, blushing a little, “if they go down
instead of up, they’ll be coming out somewhere else with an
even louder and ruder noise.”
“A whizzpopper!” cried the BFG, beaming at her.
“Us giants is making whizzpoppers all the time! Whizzpopping is
a sign of happiness. It is music in our ears! You surely is not
telling me that a little whizzpopping is forbidden among human 
beans?”
“It is considered extremely rude,” Sophie said.
“But you is whizzpopping, is you not, now and again?” asked
the BFG.
“Everyone is whizzpopping, if that’s what you call it,” 
Sophie said. “Kings and Queens are whizzpopping. Presidents
are whizzpopping. Glamorous film stars are whizzpopping.
ittle babies are whizzpopping. But where I come from,
it is not polite to talk about it.”
“Redunculous!” said the BFG. “If everyone is making whizpoppers,
then why not talk about it? We is now having a swiggle of
this delicious frobscottle and you will see the happy result.”
The BFG shook the bottle vigorously. The pale green stuff 
fizzed and bubbled. He removed the cork and took a 
tremendous gurgling swig.
“It’s glummy!” he cried. “I love it!”
For a few moments, the Big Friendly Giant stood quite still, 
and a look of absolute ecstasy began to spread over his
long wrinkly face. Then suddenly the heavens opened and
he let fly with a series of the loudest and rudest noises 
Sophie had ever heard in her life. They reverberated around
the walls of the cave like thunder and the glass jars rattled 
on their shelves. But most astonishing of all, the force of the 
explosions actually lifted the enormous giant clear off his
feet, like a rocket.
“Whoopee!” he cried, when he came down to earth again.
“Now that is whizzpopping for you!”
(Roald Dahl – The BFG 1982)
</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="16119" 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/origin-of-the-name-elixir/2303/33">Post #32</a>
	                </div>
	            </div>
              <div id="likers-container-16119" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="16119"
                     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 #32"></div>
  </section>
</div>
    <div class="postbit" id="16161" data-post-id="16161">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>So Guinness is frobscottle?  See <a href="http://web.stanford.edu/group/Zarelab/guinness/" class="inline-onebox" rel="noopener nofollow ugc">Do bubbles in Guinness go down?</a> for some enlightening 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="16161" 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/origin-of-the-name-elixir/2303/34">Post #33</a>
	                </div>
	            </div>
              <div id="likers-container-16161" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="16161"
                     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 #33"></div>
  </section>
</div>
    <div class="postbit" id="16166" data-post-id="16166">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>When I google elixir, at least I comes to these results :</p>
<ul>
<li>Elixir as programing language</li>
<li>Elixir as potion on a game</li>
<li>Elixir as a guitar string</li>
<li>Elixir as a <a href="https://laravel.com/docs/5.3/elixir" rel="noopener nofollow ugc">one of Laravel feature</a></li>
</ul>
<p><img src="https://forum.elixirforum.com/images/emoji/apple/laughing.png?v=15" title=":laughing:" class="emoji only-emoji" alt=":laughing:" loading="lazy" width="20" height="20"> <img src="https://forum.elixirforum.com/images/emoji/apple/laughing.png?v=15" title=":laughing:" class="emoji only-emoji" alt=":laughing:" loading="lazy" width="20" height="20"> <img src="https://forum.elixirforum.com/images/emoji/apple/laughing.png?v=15" title=":laughing:" class="emoji only-emoji" alt=":laughing:" loading="lazy" width="20" height="20"></p>
<p>But I think Elixir name is cool!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="16166" 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/origin-of-the-name-elixir/2303/35">Post #34</a>
	                </div>
	            </div>
              <div id="likers-container-16166" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="16166"
                     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 #34"></div>
  </section>
</div>
    <div class="postbit" id="16172" data-post-id="16172">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Owh.. come on… it must be have some meaning no? Considering elixir is a cult right now. <img src="https://forum.elixirforum.com/images/emoji/apple/laughing.png?v=15" title=":laughing:" class="emoji" alt=":laughing:" loading="lazy" width="20" height="20"></p>
<p>*jk</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="16172" 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/origin-of-the-name-elixir/2303/36">Post #35</a>
	                </div>
	            </div>
              <div id="likers-container-16172" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="16172"
                     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 #35"></div>
  </section>
</div>
    <div class="postbit" id="16176" data-post-id="16176">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>It wouldn’t surprise me. Dahl loved a beer (stout?) in his favourite pub “the old swan” I saw in a documentary. Maybe he met these men there too: “There was only one disaster. Three silly men who had drunk too much beer for lunch decided to climb over the high fence surrounding the pit, and of course they fell in. There were yells of delight from the giants below, followed by the crunching of bones.” (bfg)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="16176" 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/origin-of-the-name-elixir/2303/37">Post #36</a>
	                </div>
	            </div>
              <div id="likers-container-16176" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="16176"
                     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>