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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>What about the individuals that are not strong at elixir, but HTML and CSS, we’re alienating them by not being able to have multiple approaches. It’s way easier to learn that some of the templates contain elixir code than learning elixir.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="375642" 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/h-sigil-everywhere-vs-heex-files-any-real-world-experience/72879/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-375642" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="375642"
                     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>
    <div class="postbit" id="375644" data-post-id="375644">
  <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 no-group" data-username="garrison" data-post="20" data-topic="72879">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>Are you saying that you have never performed any logic in a HEEx template? No function calls or anything like that? If so, fair enough I guess, but you must understand this is abnormal.</p>
</blockquote>
</aside>
<p>Only helper functions that accepts data from assigns and changing them to <code>HTML</code> attribute values (or part of said value).</p>
<aside class="quote no-group" data-username="garrison" data-post="20" data-topic="72879">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>In practice most components and templates exhibit a mixing of concerns, and I believe this is not a failure of developers to separate their concerns into “logic” and “templates” but rather a failure of the framework to recognize that <em>there is no such distinction</em>.</p>
</blockquote>
</aside>
<p>If we talk about <strong>framework</strong> then yes, but <code>Phoenix</code> is not a framework. <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p>
<p>The point in both the language and <code>Phoenix</code> is flexibility. It does not exists for a bad practices, but for extending it easily without any magic and it works fine. I don’t see it as a failure, but you have to learn it as same when you are changing from <code>OOP</code> to <code>FP</code>.</p>
<aside class="quote no-group" data-username="garrison" data-post="20" data-topic="72879">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>The difference here is that the contents of the sigil are actually <em>Elixir code</em>, not a template. They just have HTML mixed in. With a compiler perhaps we could do away with the sigil entirely, like JSX.</p>
</blockquote>
</aside>
<p>Both function calls for <code>createElement</code> and <code>LiveView</code> way ends with a string, so I don’t see a difference here. Basically <code>HEEx</code> template is doing everything you said except that it returns a struct (for dynamic data) that is then parsed and called recursively to generate a <code>String</code>.</p>
<p>It would make only sense in <code>Hologram</code>, but <code>LiveView</code> would <strong>never</strong> do this, because the entire concept of it is that the rendering happens on the server side and then the diff is generated and applied. Even <code>Hologram</code> does some rendering on <code>server</code> side which makes sense, because of <code>SEO</code> (bots does not have to listen to your <code>JavaScript</code>).</p>
<p>Because of <code>SEO</code>, because it’s all based on decades old standards that are only updated (with new elements, syntax and methods) we can’t do much here no matter how how much money, people and resources we would put into it. This could be true for <code>GUI</code> apps, but not for the <code>web</code> apps. Losing <code>SEO</code> is just too much and nobody would use such a framework.</p>
<p>If you agree with that then see that supporting 2 different template compilations does not makes sense as it’s not practical. It’s simpler (which means safer, more stable and more updates) the way it is now. <strong>Unfortunately</strong> we can’t do that for the above reasons.</p>
<aside class="quote no-group" data-username="garrison" data-post="21" data-topic="72879">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>A further visual example of what I mean by “Elixir code”:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def my_component(%{error_message: error_message, count: count}) do
  zero_message = &lt;div&gt;No count!&lt;/div&gt;

  if error_message do
    &lt;div&gt;{error_message}&lt;/div&gt;
  else
    count = (count * 2) - 1
    case count do
      0 -&gt; zero_message
      n -&gt; &lt;ol&gt;{for i &lt;- n, do: &lt;li&gt;{i}&lt;/li&gt;}&lt;/ol&gt;
    end
  end
</code></pre>
</blockquote>
</aside>
<p>That would not happen at least before <code>2.0.0</code> of <code>Elixir</code> as it means a <strong>breaking changes</strong> in the language syntax. This involves <code>AST</code> an so on. I guess that such example would never be accepted for 2 reasons:</p>
<ol>
<li>It would be against <code>Elixir</code> easy of extend - it does not makes sense from language perspective to support <code>HTML</code> snippets in the source code.</li>
<li>It would be a <strong>true nightmare</strong> for syntax highlight. With <code>sigils</code> we simply do highligh on everything that’s inside the <code>text</code> literal (or interpolated text expression for some sigils), but here I don’t know if it’s even compatible especially with arithmetic operations.</li>
<li>What if people would ask for <code>XML</code> support? If there is a <code>HTML</code> one then why we don’t support  for <code>XML</code>? Then we would have questions for <code>JSON</code>, <code>Yaml</code>, configuration files, markdown and so on …</li>
</ol>
<p>Sorry, it would not work without <code>sigils</code> in my opinion. Maybe I’m not enough experienced as <strong>I’m not</strong> an <code>Elixir</code> core developer, but I don’t see it to happen at all - not in near nor far future. The language would be completely different.</p>
<aside class="quote no-group" data-username="garrison" data-post="21" data-topic="72879">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>This is what JSX does. There is no reason we could not do exactly the same thing.</p>
</blockquote>
</aside>
<p>I have no idea how <code>JSX</code> works. If it works like in way you show it would mean at best that <code>Phoenix</code> would bring it’s own version compiler. I really don’t see it happen, but maybe … someone … may create an alternative … However it would not happen soon. It would require many years, testing, adoption and so on …  Again you would need a lot of money, time and resources for that and especially people - a very skilled ones.</p>
<p><strong>Hint</strong>: Looks like you are not familiar with <code>metaprogramming</code>. Please look for <code>AST</code> and then describe to yourself your idea. Again, you would have lots of conflicts with existing operators. From a plain metaprogramming perspective your idea looks impossible.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="375644" 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/h-sigil-everywhere-vs-heex-files-any-real-world-experience/72879/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-375644" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="375644"
                     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 #22"></div>
  </section>
</div>
    <div class="postbit" id="375646" data-post-id="375646">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I am reminded of the following quote:</p>
<blockquote>
<p>Every templating language inevitably turns into a very poor programming language over time. It will grow to add conditionals, loops, scopes, macros, and other things that are much nicer in actual code.</p>
</blockquote>
<blockquote>
<p>A templating language is mainly an inner platform effect. It targets a weird imagined archetype of someone who isn’t allergic to code, but somehow isn’t smart enough to work in a genuine programming language. In my experience, this archetype doesn’t actually exist. Designers don’t want to code at all, while coders want native expressiveness.</p>
</blockquote>
<p><a href="https://acko.net/blog/get-in-zoomer-we-re-saving-react/" rel="noopener nofollow ugc">Taken from one of my favorite articles</a>.</p>
<p>Fundamentally, programming is for programmers. There seems to be an idea that we should weaken the power of programming languages to make them more accessible, but this does nothing of the sort. Non-programmers don’t look at a HEEx template and say “aha! this I can do!”. It just doesn’t work that way.</p>
<aside class="quote no-group" data-username="Schultzer" data-post="22" data-topic="72879">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/schultzer/48/4339_2.png" class="avatar"> Schultzer:</div>
<blockquote>
<p>It’s way easier to learn that some of the templates contain elixir code than learning elixir</p>
</blockquote>
</aside>
<p>The beauty of the JSX approach is that it essentially degrades into looking like HTML if the component is simple, and therefore naturally expresses the “why can we not have both” that I think you’re looking for.</p>
<p>I am not against accessibility or in favor of gatekeeping, but I draw the line at taking power <em>away</em> from programmers in some sort of misguided attempt to appeal to novices. This approach helps no-one.</p>
<p>If I might offer an analogy: templating languages are like a dull knife. Worthless to a chef, and yet also perilous to a novice.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="375646" 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/h-sigil-everywhere-vs-heex-files-any-real-world-experience/72879/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-375646" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="375646"
                     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 #23"></div>
  </section>
</div>
    <div class="postbit" id="375647" data-post-id="375647">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Eiji" data-post="23" data-topic="72879">
<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>Both function calls for <code>createElement</code> and <code>LiveView</code> way ends with a string</p>
</blockquote>
</aside>
<p>No, createElement in React (and in my hypothetical Elixir thing) does not return a string. It returns data: in JS something like <code>{tag: 'div', children: [{tag: 'span', ...}]}</code>.</p>
<p>You can think of this like the difference between something like Ecto and something which builds SQL queries by concatenating strings (<code>"SELECT * FROM" &lt;&gt; " my_table" &lt;&gt; "WHERE" ...</code>). The benefits are similar.</p>
<aside class="quote no-group" data-username="Eiji" data-post="23" data-topic="72879">
<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>but <code>LiveView</code> would <strong>never</strong> do this, because the entire concept of it is that the rendering happens on the server side and then the diff is generated and applied</p>
</blockquote>
</aside>
<p>There is no reason the diffing needs to be done on the level of strings, that’s just how it happens to be done. React diffs at the element level, logically.</p>
<p>Actually morphdom on the client does this too because just setting <code>innerHTML</code> would nuke the implicit DOM state. So you’re actually going from <code>template -&gt; strings -&gt; elements -&gt; DOM</code> when you could instead be going from <code>code -&gt; elements -&gt; dom</code>.</p>
<p>And this is all made much messier by the fact that HEEx <em>parses</em> the elements! There are several generations of tech debt stacked up on each other here.</p>
<aside class="quote no-group" data-username="Eiji" data-post="23" data-topic="72879">
<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>That would not happen at least before <code>2.0.0</code> of <code>Elixir</code> as it means a <strong>breaking changes</strong> in the language syntax.</p>
</blockquote>
</aside>
<p>I can write a compiler to do whatever I want! JSX did not require breaking changes to JS, they just transpile it back into JS. I demonstrated what that looks like.</p>
<p>As a middle-ground you could use a sigil but there’s no reason a compiler can’t just consume an entire “Elixir+HTML” file and output an “Elixir” file!</p>
<p>I want to emphasize one more time that I’m not saying <em>Phoenix</em> should necessarily do this (though I would like that very much). Honestly at this point I may as well just be sketching a framework <em>I</em> want to write. And maybe I should!</p>
<aside class="quote no-group" data-username="Eiji" data-post="23" data-topic="72879">
<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>Looks like you are not familiar with <code>metaprogramming</code>. Please look for <code>AST</code> and then describe to yourself your idea.</p>
</blockquote>
</aside>
<p>(Note the complete lack of any mention of metaprogramming in my comments.)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="375647" 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/h-sigil-everywhere-vs-heex-files-any-real-world-experience/72879/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-375647" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="375647"
                     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 #24"></div>
  </section>
</div>
    <div class="postbit" id="375648" data-post-id="375648">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Are there people out there that was born programming, or did they start out learning it little by little. I don’t disagree with any of your arguments. But I do believe that you shouldn’t be able to cut yourself no matter how you hold a tool, if that happens something fundamental has gone wrong in the design process. Thats how I approach anything. The computer is literally in front of us, lets make it work for us and not the other way around.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="375648" 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/h-sigil-everywhere-vs-heex-files-any-real-world-experience/72879/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-375648" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="375648"
                     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 #25"></div>
  </section>
</div>
    <div class="postbit" id="375649" data-post-id="375649">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="garrison" data-post="21" data-topic="72879">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>This is what JSX does. There is no reason we could not do exactly the same thing.</p>
</blockquote>
</aside>
<p>JSX offers slightly better ergonomics than a template language with a frigging compiler. It took off only because it came from a heavy weight player. I do not think that a model for small players to follow.</p>
<p>EDIT: If I reuse your example:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def my_component(%{error_message: error_message, count: count}) do
  zero_message = {:div, "No count!"}

  if error_message do
    {:div, error_message}
  else
    count = (count * 2) - 1
    case count do
      0 -&gt; zero_message
      n -&gt; {:ol, Enum.map(1..n, &amp;({:li, &amp;1}))}
    end
  end
end
</code></pre>
<p>Compared to your original JSX-ish code, this is pure elixir, as legible as yours, and the returned data is trivial to convert into html or to post-process.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="375649" 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/h-sigil-everywhere-vs-heex-files-any-real-world-experience/72879/27">Post #26</a>
	                </div>
	            </div>
              <div id="likers-container-375649" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="375649"
                     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 #26"></div>
  </section>
</div>
    <div class="postbit" id="375655" data-post-id="375655">
  <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 no-group" data-username="garrison" data-post="25" data-topic="72879">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>You can think of this like the difference between something like Ecto and something which builds SQL queries by concatenating strings (<code>"SELECT * FROM" &lt;&gt; " my_table" &lt;&gt; "WHERE" ...</code>). The benefits are similar.</p>
</blockquote>
</aside>
<p><code>ecto</code> works similar to <code>HEEx</code>. First a struct is returned an then it’s transformed into <code>HTML</code> string (Hee) and <code>SQL</code> string (ecto), see: <a href="https://hexdocs.pm/phoenix_live_view/Phoenix.LiveView.Rendered.html#t:t/0" rel="noopener nofollow ugc">type <code>t/0</code> in <code>Phoenix.LiveView.Rendered</code> @ phoenix_live_view hex documentation</a>.</p>
<aside class="quote no-group" data-username="garrison" data-post="25" data-topic="72879">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>Actually morphdom on the client does this too because just setting <code>innerHTML</code> would nuke the implicit DOM state. So you’re actually going from <code>template -&gt; strings -&gt; elements -&gt; DOM</code> when you could instead be going from <code>code -&gt; elements -&gt; dom</code>.</p>
</blockquote>
</aside>
<p>Not sure how it works inside <code>JS</code> side, but <code>Phoenix</code> is sending data in <code>JSON</code> format. You can even debug the diffs - it’s all in the official documentation.</p>
<aside class="quote no-group" data-username="garrison" data-post="25" data-topic="72879">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>And this is all made much messier by the fact that HEEx <em>parses</em> the elements! There are several generations of tech debt stacked up on each other here.</p>
</blockquote>
</aside>
<p>You can’t execute code without parsing it. At some level there is always parser involved. No matter if we do that in the language itself or within <code>Phoenix</code>. If we would not parse then we would not have all generators and conditions in the templates. We only could use a plain strings which would be a nightmare.</p>
<aside class="quote no-group" data-username="garrison" data-post="25" data-topic="72879">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>I can write a compiler to do whatever I want! JSX did not require breaking changes to JS, they just transpile it back into JS. I demonstrated what that looks like.</p>
</blockquote>
</aside>
<p>If you write a custom compiler yes, I mention it later after text you have quoted. Still it’s not gonna be easy and would be very messy because of mentioned conflicts. Look that it would not be a <code>.ex</code> files any more as we would not be able to turn the source code into <code>AST</code> without using your compiler. It’s like you saying you are fine to clone and modify language internals. Even if you do that lots of tooling would stop work, because all of editors plugins would have to implement your custom syntax.</p>
<aside class="quote no-group" data-username="garrison" data-post="25" data-topic="72879">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>I want to emphasize one more time that I’m not saying <em>Phoenix</em> should necessarily do this (though I would like that very much).</p>
</blockquote>
</aside>
<p>No, no - I’m just telling the “Phoenix story” explaining why it can’t go that way in my opinion.</p>
<aside class="quote no-group" data-username="garrison" data-post="25" data-topic="72879">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/g/3bc359/48.png" class="avatar"> garrison:</div>
<blockquote>
<p>(Note the complete lack of any mention of metaprogramming in my comments.)</p>
</blockquote>
</aside>
<p>How you see it working for <code>credo</code> and all other tools? They work on <code>Elixir</code> AST. What your compiler would do is your trouble, but credo works on the <strong>source file</strong>. Same goes for syntax highligh. You are basically asking community to support your clone of <code>Elixir</code> with “enhanced syntax” by adding <code>HTML</code> code support. Look that support for every editor is different which means that for a real support people would need to wait a lot!</p>
<p>Look, there are just too many consequences. Even if you are fine with it then everything build so far does not have to be like that. Again nobody would be motivated to support something just to support it. Bringing <code>HTML</code> into <code>Elixir</code> is not so easy. You may write your own compiler and then what? You would maintain your own LSP, syntax highlight, credo, dialyzer and literally every other tool and plugin for all existing editors?</p>
<p>Look <code>Elixir</code> is amazing and I’m not saying your idea is bad or good, but just look how long way <code>Elixir</code> made for it’s adoption and support. It’s not like that it have awesome support in literally every code editor with plugin support. Some editors are supported better and some worse. You are not going to release your own language, but your own file format. This means much less people involved even if you succeed. It just does not look like a realistic plan unless you plan for many, many years or don’t care about everyone else and “make it work” in your favourite editor, but if that’s so why people would support it if it’s just for your specific case?</p>
<p>Again, perspective - it could be an “interesting idea” or a huge waste of time in context of years of adoption. In my opinion “just adding HTML” support is not enough and once again people would ask about other formats like <code>XML</code>. What would you do? Would you maintain literally every popular format? For every editor? <code>Sigils</code> are huge winners here as they “just work” already and all we have to do is to add a syntax highlight for it and later enhance support in let’s say <code>LSP</code>. It’s faster, easier to read and maintain. You really need to have a very solid arguments for your idea completely regardless if it’s good or not.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="375655" 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/h-sigil-everywhere-vs-heex-files-any-real-world-experience/72879/28">Post #27</a>
	                </div>
	            </div>
              <div id="likers-container-375655" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="375655"
                     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 #27"></div>
  </section>
</div>
    <div class="postbit" id="375669" data-post-id="375669">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I’m going to approach this from a different perspective.</p>
<p>I had an opportunity to jump on a small-ish project a little while ago where the og author did have separate heex files. Since that’s how the project was when I got there, I just followed that convention. Although, I usually started my own LiveView code without the extracted heex files.</p>
<p>What caught my attention from the OP was the mention of the friction of having to jump between files so I’m looking at this with tools in mind. The reason the original question doesn’t bother me either way is because I’m used to doing this:</p>
<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/3X/2/0/202091dcc4d3c9a5f7029b15c623588574cf817a.jpeg" data-download-href="https://forum.elixirforum.com/uploads/default/202091dcc4d3c9a5f7029b15c623588574cf817a" title="image" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/optimized/3X/2/0/202091dcc4d3c9a5f7029b15c623588574cf817a_2_530x600.jpeg" alt="image" data-base62-sha1="4Ad3GCD2XQOscjInVXAiHEGcCEO" width="530" height="600" srcset="https://forum.elixirforum.com/uploads/default/optimized/3X/2/0/202091dcc4d3c9a5f7029b15c623588574cf817a_2_530x600.jpeg, https://forum.elixirforum.com/uploads/default/optimized/3X/2/0/202091dcc4d3c9a5f7029b15c623588574cf817a_2_795x900.jpeg 1.5x, https://forum.elixirforum.com/uploads/default/optimized/3X/2/0/202091dcc4d3c9a5f7029b15c623588574cf817a_2_1060x1200.jpeg 2x" data-dominant-color="262C3E"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1200×1358 86 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/3X/f/9/f91125559aefc0e4c5c8150d327037b3e4c6fc59.jpeg" data-download-href="https://forum.elixirforum.com/uploads/default/f91125559aefc0e4c5c8150d327037b3e4c6fc59" title="image" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/optimized/3X/f/9/f91125559aefc0e4c5c8150d327037b3e4c6fc59_2_530x600.jpeg" alt="image" data-base62-sha1="zxlCKe7Q6KFwOiAPTy0NDuWrSxX" width="530" height="600" srcset="https://forum.elixirforum.com/uploads/default/optimized/3X/f/9/f91125559aefc0e4c5c8150d327037b3e4c6fc59_2_530x600.jpeg, https://forum.elixirforum.com/uploads/default/optimized/3X/f/9/f91125559aefc0e4c5c8150d327037b3e4c6fc59_2_795x900.jpeg 1.5x, https://forum.elixirforum.com/uploads/default/optimized/3X/f/9/f91125559aefc0e4c5c8150d327037b3e4c6fc59_2_1060x1200.jpeg 2x" data-dominant-color="252B3E"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1200×1356 75 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p>In the first screenshot, I have the same big file open in 2 splits so I can see 2 different regions at the same time. In the second, I have the heex file in the top split and the LiveView module in the bottom.</p>
<p>This is just an example but I usually try to have a max of 3(maybe 4) splits in various layouts. The splits could share the same file or not, the way I interact with them is the same.</p>
<p>The example I show is my nvim setup. I also do the same in vscode and zed (and JetBrains stuff back when I used those).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="375669" 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/h-sigil-everywhere-vs-heex-files-any-real-world-experience/72879/29">Post #28</a>
	                </div>
	            </div>
              <div id="likers-container-375669" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="375669"
                     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 #28"></div>
  </section>
</div>
    <div class="postbit" id="375696" data-post-id="375696">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Schultzer" data-post="26" data-topic="72879">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/schultzer/48/4339_2.png" class="avatar"> Schultzer:</div>
<blockquote>
<p>Are there people out there that was born programming, or did they start out learning it little by little.</p>
</blockquote>
</aside>
<p>I went out of my way to take a stand against gatekeeping in my reply.</p>
<p>People who learn to program do it by programming. Templates are not pedagogically useful; in fact, they’re probably the opposite.</p>
<p>Just in case my analogy got lost: dull knives are understood to be <em>extremely dangerous</em> because they encourage the wielder to use excessive force and therefore risk causing serious harm to themselves.</p>
<p>Honestly I thought it was a pretty good analogy!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="375696" 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/h-sigil-everywhere-vs-heex-files-any-real-world-experience/72879/30">Post #29</a>
	                </div>
	            </div>
              <div id="likers-container-375696" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="375696"
                     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 #29"></div>
  </section>
</div>
    <div class="postbit" id="375699" data-post-id="375699">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>The fundamental distinction is between using templates, which use string handling and (generally) a degenerate sublanguage, and using <em>code</em> to build up the UI representation (DOM, here).</p>
<p>Your example is pretty much exactly the compilation target of the imaginary Elixir-JSX code that I showed. Except that I would point out <code>for</code> is actually a language construct <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>
<p>The only added value of JSX is that it makes the code <em>look prettier</em>. Which is entirely arbitrary! But most people seem to agree it looks prettier.</p>
<p>Whether something takes off and whether it’s good are often poorly correlated. I get the impression that many assume React is bad because it is popular, which is not true. Assuming something is bad because it’s popular is just as wrong as assuming something is <em>good</em> because it’s popular.</p>
<aside class="quote no-group" data-username="derek-zhou" data-post="27" data-topic="72879">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/derek-zhou/48/19943_2.png" class="avatar"> derek-zhou:</div>
<blockquote>
<p>with a frigging compiler</p>
</blockquote>
</aside>
<p>I hope it is not lost on you that HEEx templates are also compiled, Elixir is compiled, and JS is also often compiled from TS even without JSX anyway! Not that I would ever hate on source distribution; I am a big fan.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="375699" 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/h-sigil-everywhere-vs-heex-files-any-real-world-experience/72879/31">Post #30</a>
	                </div>
	            </div>
              <div id="likers-container-375699" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="375699"
                     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 #30"></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/72879/load_more?page=4">Load more posts (25 remaining)</a>
</div></template></turbo-stream>