<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="305278" data-post-id="305278">
  <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>I also come from a Ruby background and was all about Ruby metaprogramming (until I wasn’t).  I’ve grown to much prefer the Elixir way of life.  I too was perturbed by <code>Decimal</code> and <code>DateTime</code> the first time I saw them but I now prefer it!  Especially <code>Time#+</code> in Ruby… like, why does it allow <code>Time.new("2023-10-20 00:00:00") + 1</code>.  1 what!??  This isn’t even Rails cheekiness, this is stdlib!  Who LGTM’d that proposal??? <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> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="305278" 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/why-doesnt-elixir-support-standard-operator-overloading/59141/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-305278" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="305278"
                     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="305288" data-post-id="305288">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>If you want to go down the rabbit hole of why Elixir has made the choices it has, I suggest the following elixir-lang-core discussions:</p>
<ul>
<li><a href="https://groups.google.com/g/elixir-lang-core/c/eE_mMWKdVYY" rel="noopener nofollow ugc">https://groups.google.com/g/elixir-lang-core/c/eE_mMWKdVYY</a> (2016)</li>
<li><a href="https://groups.google.com/g/elixir-lang-core/c/W2TeQm5r1H4" rel="noopener nofollow ugc">https://groups.google.com/g/elixir-lang-core/c/W2TeQm5r1H4</a> (2022)</li>
</ul>
<p>It’s a lot of back and forth, but it was pretty eye opening for me. In particular, I think this comment from José sums up the situation well:</p>
<ul>
<li><a href="https://groups.google.com/g/elixir-lang-core/c/W2TeQm5r1H4/m/7L3RA6FlBgAJ" rel="noopener nofollow ugc">https://groups.google.com/g/elixir-lang-core/c/W2TeQm5r1H4/m/7L3RA6FlBgAJ</a></li>
</ul>
<p>There’s even an experimental implementation of a comparable protocol in that thread:</p>
<ul>
<li><a href="https://groups.google.com/g/elixir-lang-core/c/W2TeQm5r1H4/m/5DQZPshvBgAJ" rel="noopener nofollow ugc">https://groups.google.com/g/elixir-lang-core/c/W2TeQm5r1H4/m/5DQZPshvBgAJ</a></li>
</ul>
<p>But the consensus seemed to be that such an implementation would be unwieldy in practice.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="305288" 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/why-doesnt-elixir-support-standard-operator-overloading/59141/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-305288" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="305288"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-solved cat-solved" title="Marked as solution"></div>
  </section>
</div>
    <div class="postbit" id="305289" data-post-id="305289">
  <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>Oh nice!  Once again, thanks!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="305289" 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/why-doesnt-elixir-support-standard-operator-overloading/59141/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-305289" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="305289"
                     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="305301" data-post-id="305301">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="binarypaladin" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/binarypaladin/120/31708_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  binarypaladin
                    <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>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="sodapopcan" data-post="12" data-topic="59141">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sodapopcan/48/34668_2.png" class="avatar"> sodapopcan:</div>
<blockquote>
<p>I also come from a Ruby background and was all about Ruby metaprogramming (until I wasn’t). I’ve grown to much prefer the Elixir way of life.</p>
</blockquote>
</aside>
<p>As a full time Elixir dev now, I would say that overall I prefer Elixir. Toward the end of my Ruby career I was writing more functionally anyway, so a lot of dependency injection and as little implicit state as possible in classes. I was actually writing many, many function modules by the end. I still find working with dates and times in Elixir to be extremely cumbersome compared to Ruby.</p>
<p>Things like <code>date + 1.days</code> are amazing. The DSLs around dates were just cool. I know there are tradeoffs and such, but sometimes in the Elixir world there’s an immediate mentality that “clarity” is objective. It’s really not. Someone who is not a programmer can read that and grok it.</p>
<p>And I just don’t love <code>Decimal</code> as it is. I get why a line was drawn in the sand, but working with a value that is clearly and conceptually <em>a number</em> and not being able to arithmetic operators on it is—call it what you want, a trade off or a wart—to me it makes even less sense in a language that doesn’t have a concept of primitives like Java or Objective-C.</p>
<p>The problem is, of course, there isn’t a way I can think of to reasonably <em>restrict</em> overloading to just that. (I’ve always found operators to be weird anyway. In these higher level languages, they’re just functions with a special form.)</p>
<p>Anyway, just griping. There’s no such thing as the perfect language for my tastes! (Or anyone else’s, lol.)</p>
<aside class="quote no-group" data-username="billylanchantin" data-post="13" data-topic="59141">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/billylanchantin/48/28428_2.png" class="avatar"> billylanchantin:</div>
<blockquote>
<p>But the consensus seemed to be that such an implementation would be unwieldy in practice.</p>
</blockquote>
</aside>
<p>Thanks for all this info. I really appreciate the sources. I’ll read through this in depth later.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="305301" 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/why-doesnt-elixir-support-standard-operator-overloading/59141/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-305301" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="305301"
                     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="305317" data-post-id="305317">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I mostly want to reiterate a point made earlier in this thread. Overloading is discouraged „generally“ or in other words without additional context. E.g. you can look at Nx and see it overloading operators for tensor based mathematical operations, but that‘s fine because the context for that is scoped to <code>defn</code> functions.</p>
<p>Similar approaches can be done in various forms using macros.</p>
<p>I also fully acknowledge that decimals are numbers as well, but that just shows very explicitly that decimals are not a primitive datatype on the beam, but a user defined type based on maps. Same thing applies to all the datetime stuff.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="305317" 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/why-doesnt-elixir-support-standard-operator-overloading/59141/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-305317" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="305317"
                     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="305327" data-post-id="305327">
  <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">
								<aside class="quote no-group" data-username="binarypaladin" data-post="15" data-topic="59141">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/binarypaladin/48/31708_2.png" class="avatar"> binarypaladin:</div>
<blockquote>
<p>Things like <code>date + 1.days</code> are amazing. The DSLs around dates were just cool. I know there are tradeoffs and such, but sometimes in the Elixir world there’s an immediate mentality that “clarity” is objective. It’s really not. Someone who is not a programmer can read that and grok it.</p>
</blockquote>
</aside>
<p>Used to think so myself (had 6.5y with Rails before I moved to Elixir) but honestly, my day is not ruined for having to write this instead:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">NaiveDateTime.add(date, 2, :day)
</code></pre>
<p><img src="https://forum.elixirforum.com/images/emoji/apple/person_shrugging.png?v=15" title=":person_shrugging:" class="emoji only-emoji" alt=":person_shrugging:" loading="lazy" width="20" height="20"></p>
<p>Also don’t forget that time is very finicky, we still have leap seconds and summer/winter time jumps. There are situations, just in the right two dates of the year, where adding a few hours to a datetime will lead to ambiguous times, e.g. check this out: <a href="https://hexdocs.pm/timex/Timex.AmbiguousDateTime.html" class="inline-onebox" rel="noopener nofollow ugc">Timex.AmbiguousDateTime — timex v3.7.13</a></p>
<p>Having arithmetic operators for something that can jump back or forth beneath your feet I would find suboptimal and unpredictable. I’d prefer patter-matching on the result of a datetime operation, including the ambiguous results.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="305327" 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/why-doesnt-elixir-support-standard-operator-overloading/59141/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-305327" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="305327"
                     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="305344" data-post-id="305344">
  <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">
								<aside class="quote no-group" data-username="dimitarvp" data-post="17" data-topic="59141">
<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>my day is not ruined for having to write this instead</p>
</blockquote>
</aside>
<p>Ha, that’s the perfect way to put 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="305344" 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/why-doesnt-elixir-support-standard-operator-overloading/59141/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-305344" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="305344"
                     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 #17"></div>
  </section>
</div>
    <div class="postbit" id="305349" data-post-id="305349">
  <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
                  </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="binarypaladin" data-post="15" data-topic="59141">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/binarypaladin/48/31708_2.png" class="avatar"> binarypaladin:</div>
<blockquote>
<p>to me it makes even less sense in a language that doesn’t have a concept of primitives like Java or Objective-C.</p>
</blockquote>
</aside>
<p>We don’t have the concept of primitives, as in those languages, but integer and float are built-in types and decimal is a custom one. So there is a clear demarcation here. In any case, if I could, I would support <code>decimal + integer</code>, but we can’t do it today without making it slower for all cases and without breaking guard semantics. The shortest way around this is to have <code>decimal</code> as a native VM type.</p>
<p>Other than that, I am very glad to <em>not</em> have <code>date + 1.days</code>, because there isn’t anything arithmetic about it. For example, it is not guaranteed that <code>(date + duration) - duration == date</code>. I do like <code>1.days</code> though, as a mechanism to express durations, but I would be 90% as a happy if we had <code>Date.shift(date, months: 1, days: 10)</code> in Elixir (PRs are welcome, I consider this to be the last calendar feature missing in Elixir).</p>
<p>Finally, the hope is that once we have the type system, we will warn if you give a struct to any <code>&gt;</code>, <code>&gt;=</code>, <code>&lt;</code>, and <code>&lt;=</code>. It is pretty much a language pitfall that I hope we can address more reliably.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="305349" data-batch-url="/posts/batch_likers">
                        19
                      </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/why-doesnt-elixir-support-standard-operator-overloading/59141/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-305349" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="305349"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></div>
  </section>
</div>
    <div class="postbit" id="305351" data-post-id="305351">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="billylanchantin" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/billylanchantin/120/28428_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  billylanchantin
                  </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="19" data-topic="59141">
<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 would be 90% as a happy if we had <code>Date.shift(date, months: 1, days: 10)</code> in Elixir (PRs are welcome, I consider this to be the last calendar feature missing in Elixir).</p>
</blockquote>
</aside>
<p>For anyone thinking about this, the JS library luxon has a really great write-up about calendar-math vs. time-math:</p>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://moment.github.io/luxon/#/math?id=calendar-math-vs-time-math">
  <header class="source">

      <a href="https://moment.github.io/luxon/#/math?id=calendar-math-vs-time-math" target="_blank" rel="noopener nofollow ugc">moment.github.io</a>
  </header>

  <article class="onebox-body">
    

<h3><a href="https://moment.github.io/luxon/#/math?id=calendar-math-vs-time-math" target="_blank" rel="noopener nofollow ugc">luxon - Immutable date wrapper</a></h3>

  <p>Immutable date wrapper</p>


  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>
 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="305351" 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/why-doesnt-elixir-support-standard-operator-overloading/59141/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-305351" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="305351"
                     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="305352" data-post-id="305352">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="binarypaladin" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/binarypaladin/120/31708_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  binarypaladin
                    <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>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="19" data-topic="59141">
<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>We don’t have the concept of primitives, as in those languages, but integer and float are built-in types and decimal is a custom one. So there is a clear demarcation here. In any case, if I could, I would support <code>decimal + integer</code>, but we can’t do it today without making it slower for all cases and without breaking guard semantics. The shortest way around this is to have <code>decimal</code> as a native VM type.</p>
</blockquote>
</aside>
<p>Yeah, the reasons have been spelled out well in this thread. I honestly asked because if there is something I have come to expect from this language, it’s that the decisions always seem to have really solid reasoning, even where it doesn’t jive with my personal tastes. I figured from the start there were legit philosophical and technical reasons for it and looking through the mailing lists made that clear enough.</p>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="19" data-topic="59141">
<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>Other than that, I am very glad to <em>not</em> have <code>date + 1.days</code>, because there isn’t anything arithmetic about it. For example, it is not guaranteed that <code>(date + duration) - duration == date</code>. I do like <code>1.days</code> though, as a mechanism to express durations, but I would be 90% as a happy if we had <code>Date.shift(date, months: 1, days: 10)</code> in Elixir (PRs are welcome, I consider this to be the last calendar feature missing in Elixir).</p>
</blockquote>
</aside>
<p>Yeah. Honestly, I kinda wish I hadn’t even brought that up. It was just me talking about how I like the way Ruby can be written, especially for a non-programmer. I don’t think Elixir would be better for it, but I also think it’s still fine to appreciate what other languages can do. It turned into… a fixation I didn’t intend in the conversation.</p>
<p>I think anyone who has been programming for very long knows how important precision is with dates. We all have horror stories, lol. The system I am working on right now is a real beast if you’re not extremely careful about bloody time zones!</p>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="19" data-topic="59141">
<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>Finally, the hope is that once we have the type system, we will warn if you give a struct to any <code>&gt;</code>, <code>&gt;=</code>, <code>&lt;</code>, and <code>&lt;=</code>. It is pretty much a language pitfall that I hope we can address more reliably.</p>
</blockquote>
</aside>
<p><em>This</em> was the main thing I came for because that was the bug I hit. No warning. No nothing. And I know <em>why</em> it’s that way.</p>
<p>And hey, since I have you here… I love Elixir! It’s what I use professionally. I was a long time Rubyist (about 12 years) and I made the move. I still miss some bits but there’s no going back. You and your team have done such a good job with both the language and community. I can’t tell you how much it’s improved my work and me as a programmer.</p>
<p>I am continuously humbled by your ability to address even hostile comments with incredible wisdom and humility. I appreciate you taking the time to comment. Seriously.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="305352" 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/why-doesnt-elixir-support-standard-operator-overloading/59141/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-305352" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="305352"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></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>