<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>Thanks!</div><div><br></div><div>-Thorsten</div><div><br>Am 21.09.2017 um 10:07 schrieb Jonathan Hull <<a href="mailto:jhull@gbis.com">jhull@gbis.com</a>>:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html charset=utf-8">Looks like the author posted a free copy of the paper here:<div class=""><a href="http://www.hirschfeld.org/writings/media/WeiherHirschfeld_2013_PolymorphicIdentifiersUniformResourceAccessInObjectiveSmalltalk_AcmDL.pdf" class="">http://www.hirschfeld.org/writings/media/WeiherHirschfeld_2013_PolymorphicIdentifiersUniformResourceAccessInObjectiveSmalltalk_AcmDL.pdf</a></div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Jon</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 20, 2017, at 10:03 PM, Thorsten Seitz 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=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class=""></div><div class=""><br class=""></div><div class="">Am 24.08.2017 um 23:07 schrieb Eagle Offshore via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>>:<br class=""><br class=""></div><div class=""><span class=""></span></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class="">I liked the polymorphic identifiers paper presented at Dynamic Languages Symposium 2013.<div class=""><br class=""></div><div class=""><a href="http://dl.acm.org/citation.cfm?doid=2508168.2508169" class="">http://dl.acm.org/citation.cfm?doid=2508168.2508169</a></div></div></blockquote><blockquote type="cite" class=""><div class=""><div class=""><div class=""><br class=""></div><div class="">There's a lot of power in URI's that remains largely untapped in most systems.</div><div class=""><br class=""></div><div class="">There's not a great reason for this heterogeneity other than historical baggage.</div><div class=""><br class=""></div><div class="">Properly done, URI's can unify keypaths, user defaults, environment variables, files, network stores, databases, etc.</div></div></div></blockquote><div class=""><br class=""></div>Would you mind summarizing the idea as the paper is not freely available?<div class=""><br class=""></div><div class="">-Thorsten</div><div class=""><br class=""></div><div class=""><br class=""><blockquote type="cite" class=""><div class=""><div class=""><blockquote type="cite" class=""><div class="">On Aug 22, 2017, at 12:52 PM, Félix Cloutier 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=""><div class="">Just leaving it out here that the iOS/macOS app experience with paths is likely to be very different from the server (or system program) experience. Most of your paths are relative to a container because the effective root of your data is the container. I would tend to believe that a lot of your paths, not while fully static, could be expressed with something like "${<span style="font-family: SFNSText, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); float: none; display: inline !important;" data-mce-style="color: #000000; font-family: SFNSText, 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 15px; font-style: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: #ffffff; display: inline !important; float: none;" class="">DOCUMENTS</span>}/static/part", where ${DOCUMENTS} is the only thing that effectively changes. A system-level program just happens to use / as its prefix.</div><div class=""><br data-mce-bogus="1" class=""></div><div class="">Most platforms already have some notion of file domains, which are really just path prefixes (the user's home folder, the file system root, the network root, etc). I think that some level of support for these would be desirable (would it be only a set of functions that return different path prefixes). It's also my humble opinion that tilde expansion should be part of a larger shell expansion feature to avoid surprises.</div><div class=""><br data-mce-bogus="1" class=""></div><div class="">I think that I support the conclusion.</div><div class=""><br data-mce-bogus="1" class=""></div><div class="">Félix</div><div class=""><br class="">Le 22 août 2017 à 12:02, Dave DeLong <<a href="mailto:delong@apple.com" class="">delong@apple.com</a>> a écrit :<br class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="msg-quote" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" data-mce-style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">I suppose, if you squint at it weirdly.</div><div class=""><br class=""></div><div class="">My current Path API is a “Path” protocol, with “AbsolutePath” and “RelativePath” struct versions. The protocol defines a path to be an array of path components. The only real difference between an AbsolutePath and a RelativePath is that all file system operations would only take an AbsolutePath. A URL would also only provide an AbsolutePath as its “path” bit.</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;" class="" data-mce-style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;"><span style="color: #ba2da2;" class="" data-mce-style="color: #ba2da2;">public</span> <span style="color: #ba2da2;" class="" data-mce-style="color: #ba2da2;">enum</span> PathComponent {</div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;" class="" data-mce-style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;"> <span style="color: #ba2da2;" class="" data-mce-style="color: #ba2da2;">case</span> this // “."</div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;" class="" data-mce-style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;"> <span style="color: #ba2da2;" class="" data-mce-style="color: #ba2da2;">case</span> up // “..” </div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;" class="" data-mce-style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;"> <span style="color: #ba2da2;" class="" data-mce-style="color: #ba2da2;">case</span> item(name: <span style="color: #703daa;" class="" data-mce-style="color: #703daa;">String</span>, extension: <span style="color: #703daa;" class="" data-mce-style="color: #703daa;">String</span>?)</div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;" class="" data-mce-style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;">}</div></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: #ba2da2; background-color: #ffffff;" class="" data-mce-style="margin: 0px; line-height: normal; font-family: Menlo; color: #ba2da2; background-color: #ffffff;">public<span style="" class="" data-mce-style="color: #000000;"> </span>protocol<span style="" class="" data-mce-style="color: #000000;"> Path</span><span style="" class="" data-mce-style="color: #000000;"> {</span> </div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;" class="" data-mce-style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;"> <span style="color: #ba2da2;" class="" data-mce-style="color: #ba2da2;">var</span> components: <span style="color: #703daa;" class="" data-mce-style="color: #703daa;">Array</span><<span style="color: #4f8187;" class="" data-mce-style="color: #4f8187;">PathComponent</span>> { <span style="color: #ba2da2;" class="" data-mce-style="color: #ba2da2;">get</span> }</div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;" class="" data-mce-style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;"> <span style="color: #ba2da2;" class="" data-mce-style="color: #ba2da2;">init</span>(<span style="color: #ba2da2;" class="" data-mce-style="color: #ba2da2;">_</span> components: <span style="color: #703daa;" class="" data-mce-style="color: #703daa;">Array</span><<span style="color: #4f8187;" class="" data-mce-style="color: #4f8187;">PathComponent</span>>) // used on protocol extensions that mutate paths, such as appending components</div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;" class="" data-mce-style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;">}</div></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;" class="" data-mce-style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;"><span style="color: #ba2da2;" class="" data-mce-style="color: #ba2da2;">public</span> <span style="color: #ba2da2;" class="" data-mce-style="color: #ba2da2;">struct</span> AbsolutePath: <span style="color: #4f8187;" class="" data-mce-style="color: #4f8187;">Path</span> { }</div></div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;" class="" data-mce-style="margin: 0px; line-height: normal; font-family: Menlo; background-color: #ffffff;"><div style="margin: 0px; line-height: normal;" class="" data-mce-style="margin: 0px; line-height: normal;"><span style="color: #ba2da2;" class="" data-mce-style="color: #ba2da2;">public</span> <span style="color: #ba2da2;" class="" data-mce-style="color: #ba2da2;">struct</span> RelativePath: <span style="color: #4f8187;" class="" data-mce-style="color: #4f8187;">Path</span> { }</div></div><div class=""><br class=""></div><div class="">By separating out the concept of an Absolute and a Relative path, I can put additional functionality on each one to make semantic sense (you cannot concatenate two absolute paths, but you can concat any path with a relative path, for example). Or all file system operations must take an AbsolutePath. </div><div class=""><br class=""></div><div class="">One of the key things I realized is that a “Path” type should <i class="">not</i> be ExpressibleByStringLiteral, because you cannot statically determine if a Path should be absolute or relative. However, one of the initializers for an AbsolutePath would handle things like expanding a tilde, and both types try to reduce a set of components as much as possible (by filtering out “.this” components, and handling “.up” components where possible, etc). Also in my experience, it’s fairly rare to want to deal with a known-at-compile-time, hard-coded path. Usually you’re dealing with paths relative to known “containers” that are determined at runtime (current user’s home folder, app’s sandboxed documents directory, etc).</div><div class=""><br class=""></div><div class="">Another thing I’ve done is that no direct file system operations exist on AbsolutePath (like “.exists” or “.createDirectory(…)” or whatever); those are still on FileManager/FileHandle/etc in the form of extensions to handle the new types. In my app, a path is just a path, and it only has meaning based on the thing that is using it. An AbsolutePath for a URL is used differently than an AbsolutePath on a file system, although they are represented with the same “AbsolutePath” type.</div><div class=""><br class=""></div><div class="">I’m not saying this is a perfect API of course, or even that a hypothetical stdlib-provided Path should mimic this. I’m just saying that for my use-case, this has vastly simplified how I deal with paths, because both URL and String smell really bad for what I’m doing.</div><div class=""><br class=""></div><div class="">Dave</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Aug 22, 2017, at 12:37 PM, Taylor Swift <<a href="mailto:kelvin13ma@gmail.com" class="" data-mce-href="mailto:kelvin13ma@gmail.com">kelvin13ma@gmail.com</a>> wrote:</div><div class=""><div dir="ltr" class="">So are you saying we need <i class="">three</i> distinct “URI” types for local-absolute, local-relative, and remote? That’s a lot of API surface to support.<br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Aug 22, 2017 at 12:24 PM, Dave DeLong <span dir="ltr" class=""><<a href="mailto:delong@apple.com" class="" data-mce-href="mailto:delong@apple.com">delong@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;" data-mce-style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class="" data-mce-style="word-wrap: break-word;">I completely agree. URL packs a lot of punch, but IMO it’s the wrong abstraction for file system paths.<div class=""><br class=""></div><div class="">I maintain an app that deals a <i class="">lot</i> with file system paths, and using URL has always felt cumbersome, but String is the absolute wrong type to use. Lately as I’ve been working on it, I’ve been experimenting with a concrete “Path” type, similar to PathKit (<a href="https://github.com/kylef/PathKit/" class="" rel="noreferrer" data-mce-href="https://github.com/kylef/PathKit/">https://github.com/kylef/<wbr class="">PathKit/</a>). Working in terms of AbsolutePath and RelativePath (what I’ve been calling things) has been <i class="">extremely</i> refreshing, because it allows me to better articulate the kind of data I’m dealing with. URL doesn’t handle pure-relative paths very well, and it’s always a bit of a mystery how resilient I need to be about checking .isFileURL or whatever. All the extra properties (port, user, password, host) feel hugely unnecessary as well.</div><span class="HOEnZb"><span data-mce-style="color: #888888;" style="color: #888888;" class=""><div class=""><br class=""></div><div class="">Dave</div></span></span><div class=""><div class="h5"><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Aug 20, 2017, at 11:23 PM, Félix Cloutier via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="" data-mce-href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:</div><br class="m_-2591326461211282683Apple-interchange-newline"><div class=""><div style="word-wrap: break-word;" class="" data-mce-style="word-wrap: break-word;"><div class="">I'm not convinced that URLs are the appropriate abstraction for a file system path. For the record, I'm not a fan of existing Foundation methods that create objects from an URL. There is a useful and fundamental difference between a local path and a remote path, and conflating the two has been a security pain point in many languages and frameworks that allow it. Examples include remote file inclusion in PHP and malicious doctypes in XML. Windows also had its share of issues with UNC paths.</div><div class=""><br class=""></div><div class="">Even when loading an arbitrary URL looks innocuous, many de-anonymizing hacks work by causing a program to access an URL controlled by an attacker to make it disclose the user's IP address or some other ide</div></div></div></blockquote></div></div></div></div></div></blockquote></div></div></div></blockquote></div></div></blockquote></div></div></div></blockquote></div></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></blockquote></body></html>