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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>All of those different clauses that seem like language keywords that you can pass to the <code>def</code> macro, such as <code>rescue</code>, <code>catch</code>, <code>else</code>, <code>after</code> can be used in that implicit last keyword list argument. I’m pretty sure the parser limits to those atoms, which means you can’t pick arbitrary ones, however, knowing how that works could open up possibilities of cool macro features.</p>
<p>Aside: Yes, “Mad About You” was a fun 90’s sitcom <img src="https://forum.elixirforum.com/images/emoji/apple/grin.png?v=15" title=":grin:" class="emoji" alt=":grin:" 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="344056" 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/a-little-til-regarding-syntactic-sugar/67024/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-344056" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="344056"
                     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="344160" data-post-id="344160">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="gregvaughn" data-post="12" data-topic="67024">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/gregvaughn/48/954_2.png" class="avatar"> gregvaughn:</div>
<blockquote>
<p>All of those different clauses that seem like language keywords that you can pass to the <code>def</code> macro, such as <code>rescue</code>, <code>catch</code>, <code>else</code>, <code>after</code> can be used in that implicit last keyword list argument. I’m pretty sure the parser limits to those atoms, which means you can’t pick arbitrary ones, (…)</p>
</blockquote>
</aside>
<p>It is correct, the parser does seem to limit it, at least I did not succeed to use other keywords, even tough the <a href="https://github.com/elixir-lang/elixir/blob/v1.15.7/lib/elixir/lib/kernel.ex#L5178" rel="noopener nofollow ugc">macro definition</a> does not seem to have such limitations.  I didn’t go too deep down the rabbit hole. Probably with a lot of AST manipulation you might still be able to do it.</p>
<p>Is it good or bad, that I couldn’t do it? At the time I was (of course) very sad that I didn’t manage to do it and it did limit me in my creativity. I created my own DSL where I wanted to us a different keyword for the code block. I even wanted to have two code blocks (similar to a <code>do</code>-<code>else</code>- <code>end</code> block). On the other hand, I’m not sure whether it would have helped, because it might have lead me to create an unnatural, awkward, complex monster.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="344160" 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/a-little-til-regarding-syntactic-sugar/67024/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-344160" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="344160"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="344185" data-post-id="344185">
  <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
                    <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">
								<p>Are you talking about using any random word here?  The “sugar” words are definitely reserved as they cannot be used as identifiers.  Even though you can do some pretty wild stuff, Elixir doesn’t let you make up completely random syntax.  For example, <a href="https://hexdocs.pm/elixir/main/operators.html#defining-custom-operators" rel="noopener nofollow ugc">it only allows a fixed set of infix operators</a> beyond the ones that are already in use.  There are some other limitations that prevent you from too hog wild that I can’t remember off the top of my head.</p>
<p>There may be <em>some</em> way you could wrangle it but it would be super confusing since:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">foo do
  true
bar
  false
end
</code></pre>
<p>Is normally just parsed as:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">foo do
  true
  bar()
  false
end
</code></pre>
<p>You could treat everything between <code>bar</code> and <code>end</code> differently, but Elixir isn’t a whitespace significant language so it would just be really confusing.  The formatter would always rewrite it to the latter form, for example.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="344185" 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/a-little-til-regarding-syntactic-sugar/67024/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-344185" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="344185"
                     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="344212" data-post-id="344212">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yes, that was exactly the initial plan to have something like</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">foo a: 1 bar
  # some code
end
</code></pre>
<p>Even though it does limit the DSL you can create from it. It does help to keep DSLs still somewhat consistent and I do think (in the meantime) that it’s a good thing <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="344212" 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/a-little-til-regarding-syntactic-sugar/67024/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-344212" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="344212"
                     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>