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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-Erlang-Core-Team" data-username="rvirding" data-post="52" data-topic="2397">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/rvirding/48/1409_2.png" class="avatar"> rvirding:</div>
<blockquote>
<p>What a binary looks like is very much syntax, the same as for all the other data types.</p>
</blockquote>
</aside>
<p>I don’t think we agree. You say it <strong>looks like it is syntax</strong>. I say it <strong>is</strong> syntax. It’s a sequence of symbols that’s translated into an AST in a very unconventional way compared to the rest of the language (the same goes for maps, tuples, etc).</p>
<aside class="quote group-Erlang-Core-Team" data-username="rvirding" data-post="50" data-topic="2397">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/rvirding/48/1409_2.png" class="avatar"> rvirding:</div>
<blockquote>
<p>For most users of Elixir whether parts of the “standard syntax” like def and if are built-in syntax or macros is completely irrelevant.</p>
</blockquote>
</aside>
<p>You’ve written this, which makes me think you think these cases are analogous. My position is that <code>def</code> and <code>if</code> <em>look like</em> syntax (they are turned into an AST node the way any function call is), while <code>&lt;&lt;...&gt;&gt;</code> <em>is syntax</em> (the parser does funny stuff with it to turn it into an AST node).</p>
<p>Or am I misunderstanding your position?</p>
<p>EDIT: The individual expressions separated by commas inside of a <code>&lt;&lt;...&gt;&gt;</code> are certainly <strong>not</strong> syntax (but they do look like it, enough to fool me before trying quote a binary <code>quote do &lt;&lt;...&gt;&gt; end</code>, like José showed above).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="44080" 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/elixir-language-reference/2397/53">Post #52</a>
	                </div>
	            </div>
              <div id="likers-container-44080" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="44080"
                     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 #52"></div>
  </section>
</div>
    <div class="postbit" id="44082" data-post-id="44082">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-Erlang-Core-Team" data-username="rvirding" data-post="50" data-topic="2397">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/rvirding/48/1409_2.png" class="avatar"> rvirding:</div>
<blockquote>
<p>Again, I think most users, even those who write big complex systems, will not define their own macros even though they will be using lots of things defined by macros.</p>
</blockquote>
</aside>
<p>I wonder if there should be two reference guides: one for <em>Developers who don’t want to write macros</em> and one for <em>Developers who want to write macros</em>, maybe titled something like:</p>
<ol>
<li>
<p><em>Reference for Developers who don’t like LISP or don’t know what it is</em>, which basically describes elixir like if it were python. After all, it has <code>def</code>, <code>if</code>, <code>with</code>, <code>Enum.reduce_while</code> (basically a  python <code>for</code> loop that doesn’t leak outside the scope). <code>defmacro</code> does not exist and the <code>|&gt;</code> operator is a special form that does magic with your functions to put the arguments in the right place. Modules are like classes that have no internal state and can’t be instantiated, unless they inherit (sorry, use! they use!) GenServers and you mess with something arcane like the process registry. Then you get gets and sets and mutable internal object state. Ok, I’ll stop now <img src="https://forum.elixirforum.com/images/emoji/apple/smile.png?v=15" title=":smile:" class="emoji" alt=":smile:" loading="lazy" width="20" height="20"></p>
</li>
<li>
<p><em>Reference for Developers who think that LISP is the best thing ever and that the characters that compose the program are mere distractions from the holy truth of the AST</em>, which describes elixir as if it were LISP and in which after chapter 2 all programs are written directly by manipulating the AST using functions (<code>do ... end</code>? <code>defmacro</code>? who needs them? We write our AST directly!)</p>
</li>
</ol>
<p>Despite the joking nature of these titles, and the parody-like description, I’m being serious, and I’d totally buy a book like number two if someone were to write it. And if <a class="mention" href="/u/rvirding" rel="nofollow">@rvirding</a>’s right, then reference <span class="hashtag-raw">#1</span> might be useful for many people too.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="44082" 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/elixir-language-reference/2397/54">Post #53</a>
	                </div>
	            </div>
              <div id="likers-container-44082" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="44082"
                     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 #53"></div>
  </section>
</div>
    <div class="postbit" id="44121" data-post-id="44121">
  <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="tmbb" data-post="54" data-topic="2397">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/t/77aa72/48.png" class="avatar"> tmbb:</div>
<blockquote>
<p>Reference for Developers who think that LISP is the best thing ever and that the characters that compose the program are mere distractions from the holy truth of the AST</p>
</blockquote>
</aside>
<p>Mmmmmmmm…  ^.^</p>
<p>I mean, uh, <em>cough</em>…</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="44121" 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/elixir-language-reference/2397/55">Post #54</a>
	                </div>
	            </div>
              <div id="likers-container-44121" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="44121"
                     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 #54"></div>
  </section>
</div>
    <div class="postbit" id="44156" data-post-id="44156">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yes, you are misunderstanding my position.</p>
<aside class="quote no-group quote-modified" data-username="tmbb" data-post="53" data-topic="2397" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/t/77aa72/48.png" class="avatar"> tmbb:</div>
<blockquote>
<aside class="quote group-Erlang-Core-Team" data-username="rvirding" data-post="52" data-topic="2397">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/rvirding/48/1409_2.png" class="avatar"> rvirding:</div>
<blockquote>
<p>What a binary looks like is very much syntax, the same as for all the other data types.</p>
</blockquote>
</aside>
<p>I don’t think we agree. You say it <strong>looks like it is syntax</strong>. I say it <strong>is</strong> syntax. It’s a sequence of symbols that’s translated into an AST in a very unconventional way compared to the rest of the language (the same goes for maps, tuples, etc).</p>
</blockquote>
</aside>
<p>We do agree. I <strong>did not say</strong> that “it looks like syntax”, what I said was “<em>what a binary looks like</em>” “<strong>is</strong> very much syntax”. I could flip the order and say syntax is what they look like.</p>
<aside class="quote no-group quote-modified" data-username="tmbb" data-post="53" data-topic="2397" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/t/77aa72/48.png" class="avatar"> tmbb:</div>
<blockquote>
<aside class="quote group-Erlang-Core-Team" data-username="rvirding" data-post="50" data-topic="2397">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/rvirding/48/1409_2.png" class="avatar"> rvirding:</div>
<blockquote>
<p>For most users of Elixir whether parts of the “standard syntax” like def and if are built-in syntax or macros is completely irrelevant.</p>
</blockquote>
</aside>
<p>You’ve written this, which makes me think you think these cases are analogous. My position is that <code>def</code> and <code>if</code> <em>look like</em> syntax (they are turned into an AST node the way any function call is), while <code>&lt;&lt;...&gt;&gt;</code> <em>is syntax</em> (the parser does funny stuff with it to turn it into an AST node).</p>
</blockquote>
</aside>
<p>Again I did not say looks like syntax, but what it looks like <strong>is</strong> syntax. And I see <code>def</code> and <code>if</code> as syntax as they are part of the standard definition of the Elixir language. In the same as data types.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="44156" 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/elixir-language-reference/2397/56">Post #55</a>
	                </div>
	            </div>
              <div id="likers-container-44156" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="44156"
                     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 #55"></div>
  </section>
</div>
    <div class="postbit" id="44166" data-post-id="44166">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-Erlang-Core-Team" data-username="rvirding" data-post="56" data-topic="2397">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/rvirding/48/1409_2.png" class="avatar"> rvirding:</div>
<blockquote>
<p>We do agree. I did not say that “it looks like syntax”, what I said was “what a binary looks like” “is very much syntax”.</p>
</blockquote>
</aside>
<p>Ok, we do agree on this one.</p>
<aside class="quote group-Erlang-Core-Team" data-username="rvirding" data-post="56" data-topic="2397">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/rvirding/48/1409_2.png" class="avatar"> rvirding:</div>
<blockquote>
<p>And I see def and if as syntax as they are part of the standard definition of the Elixir language. In the same as data types.</p>
</blockquote>
</aside>
<p>Here I’m not sure we agree. The definition of syntax I use (it’s been a long time since I’ve read a book on the subject) is the same as the one given on Wikipedia (<a href="https://en.wikipedia.org/wiki/Syntax_(programming_languages)" class="inline-onebox" rel="noopener nofollow ugc">Syntax (programming languages) - Wikipedia</a>):</p>
<blockquote>
<p>In computer science, the syntax of a computer language is the set of rules that defines the combinations of symbols that are considered to be a correctly structured document or fragment in that language.</p>
</blockquote>
<p>While semantics is (from the same article):</p>
<blockquote>
<p>The syntax of a language describes the form of a valid program, but does not provide any information about the meaning of the program or the results of executing that program. The meaning given to a combination of symbols is handled by semantics (either formal or hard-coded in a reference implementation). Not all syntactically correct programs are semantically correct.</p>
</blockquote>
<p>From the point of view of the syntax, there is nothing special about <code>if</code> and <code>def</code>. The rules you use to decide whether they are part of a valid program are the same. They are both ordinary identifiers.</p>
<p>I admit my perspective might be too pedantic, strict and theoretical. After all, you’re the one who has implemented (real, used by may people) languages in practice, so I certainly respect your mental models regarding this topic!</p>
<p>But in this case, the difference these definitions draw between Syntax and Semantics is useful to me, while your nebulous notion of “it’s syntax if most programmers agree it is” is to vague for me personally.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="44166" 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/elixir-language-reference/2397/57">Post #56</a>
	                </div>
	            </div>
              <div id="likers-container-44166" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="44166"
                     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 #56"></div>
  </section>
</div>
    <div class="postbit" id="44169" data-post-id="44169">
  <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">
								<p>Just an aside, <code>if</code> really should not be a special form or parsed with the syntax or anything of the sort in Elixir, it could easily be just a macro like:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmacro if(cond_ast, bodies) do
  then_body = bodies[:do]
  else_body = bodies[:else]
  quote do
    cond do
      unquote(cond_ast) -&gt; unquote(then_body)
      true -&gt; unquote(else_body)
    end
  end
end
</code></pre>
<p>Or something of that sort.  There’s no reason for it to be anything but a macro in <code>Kernel</code>, oh and look <a href="https://github.com/elixir-lang/elixir/blob/v1.5.1/lib/elixir/lib/kernel.ex#L2613" rel="noopener nofollow ugc">it is</a> (although it does some weird stuff like special case the random atom <code>nil</code> and such… <em>*cough*</em> <em>still not a fan of <code>nil</code> being special at all</em>), but yea it is not syntax, nor is <a href="https://github.com/elixir-lang/elixir/blob/v1.5.1/lib/elixir/lib/kernel.ex#L3495" rel="noopener nofollow ugc"><code>def</code></a> as it is just a macro as well.</p>
<p>The point of this is, since they are macro’s then the user could override them to make them do something else (like how I override <code>def</code> in my <code>defguard</code> library to allow you to define super-guards like <code>is_struct</code> (I still think my style (though complete) of <code>defguard</code> should be built-in to elixir) (I might be in a lisp’y mood…)), but because of that syntax coloring them special may not always make sense, like say in a DSEL.</p>
<p>What I really really hate being special-form’d are things like <code>with</code> and <code>for</code>, both of those could have been done in other more traditionally ‘macro’ ways without the comma-splosion, but since they are special-formed then syntax coloring on them can be specialized…</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="44169" 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/elixir-language-reference/2397/58">Post #57</a>
	                </div>
	            </div>
              <div id="likers-container-44169" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="44169"
                     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>