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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<blockquote>
<p>I saw just <code>&amp;</code></p>
</blockquote>
<p>I don’t think this is correctly parsable, as it is hard-coded in the parser to be an arity-1 operator.  I could be wrong. though.  it would have to be <code>:&amp;</code></p>
<blockquote>
<p>language enhancement</p>
</blockquote>
<p>I don’t think it’s appropriate as a language enhancement.  I’m not sure what a pipe extension should look like.</p>
<p>for starters, I want to to sometimes assign a value to the end of the pipe.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">foo = bar
|&gt; baz()
|&gt; quux()
</code></pre>
<p>to:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">bar
|&gt; baz()
|&gt; quux()
|&gt; foo
</code></pre>
<p>This should obviously be a match operation, so:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">{:ok, foo} = bar
|&gt; baz()
|&gt; quux()
</code></pre>
<p>becomes:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">bar
|&gt; baz()
|&gt; quux()
|&gt; {:ok, foo}
</code></pre>
<p>well that doesn’t feel right (and conflicts, for example, with the proposal in this thread), but probably there should be SOME operator that does this, and now it becomes a challenge to decide which one “deserves” to be on the end of <code>|&gt;</code>.  The best choice is to have <code>|&gt;</code> do one thing and one thing well.</p>
<p>Anyways there are two similarly shaped operators: <code>~&gt;</code> and <code>~&gt;&gt;</code>,  so those are both options, if anything is going happen to change the language it would be to ask the elixir team to release more pipe-y operators, into the parser for people to use in their libraries, like <code>-&gt;&gt;</code> and <code>=&gt;&gt;</code>, if we want to get wild, <code>==&gt;</code>, <code>=~&gt;</code>, <code>=-&gt;</code> might be fun 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="180418" 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/a-simple-macro-to-allow-bare-captures-in-pipes/32516/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-180418" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="180418"
                     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="180425" data-post-id="180425">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<blockquote>
<p>it would have to be :&amp;</p>
</blockquote>
<p>Yeah, you’re probably right and I shouldn’t have even mentioned it. Moreso, just saying I like sticking with the capture syntax because it is already established. <code>&amp;1</code> still looks the best to my eyes.</p>
<blockquote>
<p>for starters, I want to sometimes assign a value to the end of the pipe</p>
</blockquote>
<p>Well, now we’re in the land of talking about making a thing that doesn’t exist work together with another thing that does not exist, but I guess I’ll play. <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>If I’m understanding correctly, you want to be able to bind a variable within a pipe. This seems like a totally different language feature than the syntactic sugar of OP’s feature which is focused on simplifying how a value is passed down through a pipeline. I agree that a different operator should be used for such a thing were it to exist, but I think this would work just fine with the proposed syntax of the OP.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">bar
|&gt; {:ok, &amp;1} # OP's feature
|= {:ok, foo} # binding a variable at the end of a pipeline (or ==&gt;, =~&gt;, =-&gt;, etc.)
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="180425" 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-simple-macro-to-allow-bare-captures-in-pipes/32516/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-180425" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="180425"
                     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="180435" data-post-id="180435">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="baldwindavid" data-post="13" data-topic="32516">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/baldwindavid/48/17559_2.png" class="avatar"> baldwindavid:</div>
<blockquote>
<p>This seems like a totally different language feature than the syntactic sugar of OP’s feature which is focused on simplifying how a value is passed down through a pipeline.</p>
</blockquote>
</aside>
<p>Indeed, this is the goal I am intending.</p>
<aside class="quote no-group" data-username="baldwindavid" data-post="11" data-topic="32516">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/baldwindavid/48/17559_2.png" class="avatar"> baldwindavid:</div>
<blockquote>
<p>My assumption is that <a class="mention" href="/u/qqwy" rel="nofollow">@Qqwy</a> at least has some visions of this being added to the language, but I might be wrong there.</p>
</blockquote>
</aside>
<p><em>Maybe</em>. I know that the Elixir core-team is very cautious in adding language features in general, and pipes especially. There have been many proposals and attempts in the past to make the pipe notation more powerful on a language level.<br>
It is difficult to come up with a syntax that is more powerful without also becoming more terse (less readable).</p>
<p>Anonymous functions are in general discouraged in pipes in Elixir because by wide consensus it is considered better practice (for the readability/maintainability of the code) to give those functions a name. This is one of the two reasons that you are currently required to add <code>.()</code> manually to an anonymous function used in a pipe (<small>the other being to keep behaviour the same between <code>10 |&gt; (fn x -&gt; x + 1 end).()</code> and <code>foo = fn x -&gt; x + 1 end; x |&gt; foo.()</code></small>).</p>
<p>Capture-syntax, while considered a ‘shorthand’ for anonymous functions, is treated differently from anonymous functions by the compiler. (I do not know the reason for this. <a class="mention" href="/u/josevalim" rel="nofollow">@josevalim</a>, if you have the time, could you maybe enlighten us?)</p>
<p>Currently, captures are not allowed in pipes at all. Only when we transform a capture into an anonymous function by wrapping the capture inside parentheses and then also add the <code>.()</code> required for anonymous functions is it possible to use a capture in a pipe today.<br>
Personally I think it would improve the readability of Elixir-code by reducing the boilerplate in many functions if capture-syntax would be allowed to exist bare inside a pipe. (as e.g. <code>{:ok, &amp;1}</code> but I would also be content with for instance <code>&amp;{:ok, &amp;1}</code>).</p>
<p>I don’t expect the Elixir-core team to agree with me on this, however, for the afore-mentioned reasons.<br>
The one thing that <em>might</em> make this proposal better (arguably, in my personal opinion) w.r.t. earlier proposals is that it tries to stay very close to what is already possible in Elixir today. This means it should not surprise programmers and prevent code written with the new syntax from becoming terse/unreadable.</p>
<p>In the (very likely) case where this addition does not make it into the language proper, I’d like to release it as a library.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="180435" data-batch-url="/posts/batch_likers">
                        3
                      </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-simple-macro-to-allow-bare-captures-in-pipes/32516/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-180435" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="180435"
                     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="180459" data-post-id="180459">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think you’re missing my point.  There are good arguments for any number of ‘enhancements’ to the pipe syntax.  Which is more pipeish is a very squirrelly subjective call, with no one best justification for any given one, and all of them pay the penalty of “overloading the pipe operator to do more than one conceptual thing”.  The most reasonable course of action is, then to basically do nothing, and let all pipe enhancements (to include OP’s, and the one that I showed, which is actually implemented in some library or another I can’t remember) live in the world of user imported libraries.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="180459" 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/a-simple-macro-to-allow-bare-captures-in-pipes/32516/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-180459" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="180459"
                     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="180464" data-post-id="180464">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<blockquote>
<p>I think you’re missing my point.</p>
</blockquote>
<p>I do think I missed your point, but I get you now and can completely appreciate that sentiment.</p>
<p>This is a controversial topic and as <a class="mention" href="/u/qqwy" rel="nofollow">@Qqwy</a> noted, it would be very unlikely to actually get accepted into the language. As I mentioned in an earlier comment, I’ve seen a bunch of these proposals (and you’ve probably seen more) and none of them were appealing to me. This one just has me excited.</p>
<blockquote>
<p>“overloading the pipe operator to do more than one conceptual thing”</p>
</blockquote>
<p>I guess I just don’t see it as doing more than one conceptual thing. The purpose of the pipe operator as I understand it is to pass the result of an expression as the first parameter of another expression. This just seems like a more succinct way of doing that thing AND leveraging known and unsurprising (to me, at least) syntax.</p>
<blockquote>
<p>The most reasonable course of action is, then to basically do nothing</p>
</blockquote>
<p>Sure, that is the likely outcome. If the OP and I were the only people for which this is appealing, I think it is safe to say it won’t be added to the language anytime soon. :). But I presume OP has posted here to vet and see if there is any groundswell of support from developers and the core team. Barring unforeseen technical issues, this probably comes down to preference.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="180464" data-batch-url="/posts/batch_likers">
                        3
                      </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-simple-macro-to-allow-bare-captures-in-pipes/32516/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-180464" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="180464"
                     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="180526" data-post-id="180526">
  <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">
								<p>Today you can write: <code>&amp; foo |&gt; bar(:value, &amp;1) |&gt; baz()</code>. With your proposal, how do you know if <code>&amp;1</code> binds to the wrapping <code>&amp;</code> or it is just an extension of the pipe? <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="180526" data-batch-url="/posts/batch_likers">
                        9
                      </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-simple-macro-to-allow-bare-captures-in-pipes/32516/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-180526" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="180526"
                     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="180537" data-post-id="180537">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Since nested captures are disallowed I would think we should expect that <code>&amp;1</code> here binds to the wrapping <code>&amp;</code>. Is it possible to detect that it is already within a capture and “hold the sugar”?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="180537" 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/a-simple-macro-to-allow-bare-captures-in-pipes/32516/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-180537" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="180537"
                     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="180589" data-post-id="180589">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Very interesting! This was a syntactical ambiguity I had not considered.</p>
<p>The <code>&amp;{:ok, &amp;1}</code>-syntax (still without requiring wrapping this in <code>(...).()</code>) that I mentioned a couple posts back would not have the same problem:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># This will raise a compile-time error about nested captures as expected
&amp;( foo |&gt; &amp;bar(:value, &amp;1) |&gt; baz() )
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="180589" 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-simple-macro-to-allow-bare-captures-in-pipes/32516/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-180589" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="180589"
                     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 #18"></div>
  </section>
</div>
    <div class="postbit" id="180621" data-post-id="180621">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>From my example above, the following tweaks should work, correct?</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def speak(name, greeting) do
  name
  # * function that requires different order
  |&gt; &amp;greet(greeting, &amp;1)
  # regular function still works fine
  |&gt; String.upcase()
  # does not disrupt adding ellipses via original method
  |&gt; (&amp;(&amp;1 &lt;&gt; "...")).()
  # * example of adding ellipses with enhanced pipe
  |&gt; &amp;("..." &lt;&gt; &amp;1)
  # * returning a tuple
  |&gt; &amp;{:ok, &amp;1}
end
</code></pre>
<p>I like this just as much and it looks even more obvious. It does appear the formatter would need some work to support it though.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="180621" 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/a-simple-macro-to-allow-bare-captures-in-pipes/32516/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-180621" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="180621"
                     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="180631" data-post-id="180631">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="baldwindavid" data-post="20" data-topic="32516">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/baldwindavid/48/17559_2.png" class="avatar"> baldwindavid:</div>
<blockquote>
<p>From my example above, the following tweaks should work, correct</p>
</blockquote>
</aside>
<p>Correct. Although, writing <a href="https://gist.github.com/Qqwy/47b2bed1d307babf31113d41716dd3fc" rel="noopener nofollow ugc">a simple attempt to implement it</a> I found out that <code>&amp;</code> will capture everything that follows it, even if parentheses are used, meaning that using Elixir’s current syntax rules</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">10 |&gt; &amp;({:ok, &amp;1})) |&gt; &amp;([1,2,3, &amp;1]
</code></pre>
<p>is interpreted as</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">10 |&gt; (&amp;{:ok, &amp;1} |&gt; (&amp;[1, 2, 3, &amp;1]).()).()
</code></pre>
<p>which will fail because of ‘nested captures’.</p>
<p>rather than the desired</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">10 |&gt; (&amp;{:ok, &amp;1}).() |&gt; (&amp;[1, 2, 3, &amp;1]).()
</code></pre>
<p><a href="https://gist.github.com/Qqwy/8d53ee52102bf5453bc57b65227246df" rel="noopener nofollow ugc">Here is an updated implementation that fixes this</a>, by rewriting the construct <code>a |&gt; &amp;b |&gt; c</code> to <code>a |&gt; (&amp;b) |&gt; c</code> <small>where a, b, and c are arbitrary ASTs </small>.<br>
At first I was a bit concerned that this more rigorous rewrite would alter the behaviour of existing programs, but this is not the case since this syntax would not compile without the extension. The extension is thus backwards compatible.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="180631" 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/a-simple-macro-to-allow-bare-captures-in-pipes/32516/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-180631" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="180631"
                     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 #20"></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/32516/load_more?page=3">Load more posts (11 remaining)</a>
</div></template></turbo-stream>