<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=""><div class="">Take a peek at this: <a href="https://gist.github.com/erica/c92f6ab115af89d5c4b9161487df6a3c" class="">https://gist.github.com/erica/c92f6ab115af89d5c4b9161487df6a3c</a></div><div class=""><br class=""></div><div class="">--E</div><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 16, 2016, at 2:58 PM, Micah Hainline via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Charles,<br class=""><br class="">There's already something like that for file URLs in a playground,<br class="">though I'm not sure about compile-time checking or how that might work<br class="">outside of playgrounds.<br class=""><br class=""><a href="https://lists.swift.org/pipermail/swift-evolution-announce/2016-March/000060.html" class="">https://lists.swift.org/pipermail/swift-evolution-announce/2016-March/000060.html</a><br class=""><br class="">Of course, my proposal would work fine for file URLs, just not for<br class="">turning file paths INTO URLs.<br class=""><br class="">On Fri, Dec 16, 2016 at 3:05 PM, Charles Srstka<br class=""><cocoadev@charlessoft.com> wrote:<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">On Dec 16, 2016, at 2:46 PM, Micah Hainline via swift-evolution <swift-evolution@swift.org> wrote:<br class=""><br class="">I would like to be able to create a URL literal that is compile-time<br class="">checked for correct format. This would help avoid code like this:<br class=""><br class=""> let url: URL = URL(string: "https://example.com")!<br class=""><br class="">The cleanest way I can think of doing that would be to introduce a new<br class="">macro structure similar to #selector, though I'm open to other ideas.<br class="">I would think it should take a quoted literal string to avoid<br class="">problems. That would look like this:<br class=""><br class=""> let url: URL = #url("https://example.com")<br class=""><br class="">What does everyone think of that idea?<br class="">_______________________________________________<br class="">swift-evolution mailing list<br class="">swift-evolution@swift.org<br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></blockquote><br class=""><br class="">I’d like to see something like that for file path URLs. For something so commonly used, URL(fileURLWithPath:) is obnoxiously verbose.<br class=""><br class="">Charles<br class=""><br class=""></blockquote>_______________________________________________<br class="">swift-evolution mailing list<br class="">swift-evolution@swift.org<br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></div></blockquote></div><br class=""></body></html>