<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 22, 2016, at 11:42 AM, Jordan Rose &lt;<a href="mailto:jordan_rose@apple.com" class="">jordan_rose@apple.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><br class=""><blockquote type="cite" class="">On Jan 21, 2016, at 21:44, Joe Groff via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Jan 21, 2016, at 9:25 PM, Erica Sadun via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class="">Okay, you know this was coming: let's Groff this thing.<br class=""><br class="">How about #(line) where you can decouple the specific compiler implementation bits from the keyword bits without hardcoding support, enabling implementation of, for example, #(runcible) for future Swift compiler substitution logic.<br class=""></blockquote><br class="">If you're going to bring me into it…I would prefer coalescing all these __FILE__, __LINE__, etc. things into one #sourceLocation structure. If you want one source-location-related thing, you tend to want the others, and you also want to be able to forward the source location info easily through the depths of your assertion/logging framework.<br class=""></blockquote><br class="">The downside is that this becomes Yet Another Compiler-Known Type and Yet Another Thing In the Standard Library. All the current fields are string literals and integer literals.<br class=""></div></div></blockquote></div><br class=""><div class="">True, though we could make it a tuple or invent a new SourceLocLiteralConvertible protocol. However, Andrew Bennett suggested an interesting approach in&nbsp;<a href="https://bugs.swift.org/browse/SR-198:" class="">https://bugs.swift.org/browse/SR-198:</a></div><div class=""><br class=""></div><div class=""><pre class="code-java" style="margin-top: 0px; margin-bottom: 0px; padding: 0px; max-height: 30em; overflow: auto; white-space: pre-wrap; word-wrap: normal; color: rgb(51, 51, 51);"><span class="code-keyword" style="color: rgb(0, 0, 145);">public</span> struct SourceLocation {
    init(file: <span class="code-object" style="color: rgb(145, 0, 145);">String</span> = __FILE__, line: Int = __LINE__, column: Int = __COLUMN__, function: <span class="code-object" style="color: rgb(145, 0, 145);">String</span> = __FUNCTION__) {
        self.file = file
        self.line = line
        self.column = column
        self.function = function
    }

    <span class="code-keyword" style="color: rgb(0, 0, 145);">public</span> var file: <span class="code-object" style="color: rgb(145, 0, 145);">String</span>
    <span class="code-keyword" style="color: rgb(0, 0, 145);">public</span> var line: Int
    <span class="code-keyword" style="color: rgb(0, 0, 145);">public</span> var column: Int
    <span class="code-keyword" style="color: rgb(0, 0, 145);">public</span> var function: <span class="code-object" style="color: rgb(145, 0, 145);">String</span>
}</pre><div class=""><br class=""></div></div><div class="">If we apply the default argument rules for #line, #column, etc. at depth, so that if you use 'SourceLocation()' as a default parameter you get the caller's source location as default arguments to SourceLocation(), then you could build aggregate source location structures from the primitives we have today.</div><div class=""><br class=""></div><div class="">-Joe</div></body></html>