<div dir="ltr">On Sat, Jan 14, 2017 at 5:35 PM, Amir Michail <span dir="ltr"><<a href="mailto:a.michail@me.com" target="_blank">a.michail@me.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Jan 14, 2017, at 6:28 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com">xiaodi.wu@gmail.com</a>> wrote:<br>
><br>
> This has been brought up on this list before. The conclusion of the previous thread on this topic was that there is a way to do this:<br>
><br>
> #if false<br>
> // put your code here<br>
> #endif<br>
><br>
<br>
</span>This would not check the code for compilability within the surrounding code. This requires more than a syntax check.</blockquote><div><br></div><div>I can't say I've ever needed that feature; could you share a concrete use case?</div><div><br></div><div>In any case, if you put code in a function that's not exported and never invoked, I believe you would achieve the desired effect. Within the body of a function, you could do so in a closure.</div><div><br></div><div>```</div><div>func foo() {</div><div> // code you want to run</div><div> _ = {</div><div> // code you don't intend to run</div><div> }</div><div> // more code you want to run</div><div>}</div><div>```</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
> It does not allow you to comment out fragments of a single statement, but the incremental value of devoting time to additionally support that is, it would seem, low.<br>
><br>
> On Sat, Jan 14, 2017 at 17:18 Amir Michail via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
> The code in a “code comment" must compile (not just be syntactically correct) yet must not have any effect on the resulting executable.<br>
><br>
> For example, commented entries in an array would be checked for compilability but would not be included in the executable.<br>
><br>
> Such “code comments" would allow you to have code/data that is currently unused but is constantly checked to be valid just in case you want to use it in the future.<br>
><br>
> ______________________________<wbr>_________________<br>
> swift-evolution mailing list<br>
> <a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br>
</div></div></blockquote></div><br></div></div>