<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="">Le 5 févr. 2016 à 19:22, Erwin Mazariegos via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">Personally I am enjoying the safety of not having to prefix custom types in my apps. But if I was writing a third-party library, I would want to use a "signature prefix" on my types. Similarly, the NS prefix should remain on Apple-supplied Foundation types.&nbsp;</div></div></blockquote><br class=""></div><div>This is a very interesting topic.</div><div><br class=""></div><div>I personally don’t use any prefix, but I’m still very careful to avoid names that are too general.</div><div><br class=""></div><div>Looking at the main public types of my&nbsp;<a href="http://github.com/groue/GRDB.swift" class="">http://github.com/groue/GRDB.swift</a> (I mean the types that the library user is likely to write in her own code, not the types of temporary values that are usually not written thanks to the Swift type inference), you should be able to guess what the library is about:</div><div><br class=""></div><div>Concrete types:</div><div>- Configuration</div><div>- DatabaseQueue</div><div>- DatabaseMigrator</div><div>- Record</div><div>- Row</div><div>- SQLColumn</div><div><br class=""></div><div>Errors:</div><div>- PersistenceError</div><div>- DatabaseError</div><div><br class=""></div><div>Protocols:</div><div>- DatabaseValueConvertible</div><div>- Persistable</div><div>- RowConvertible</div><div>- TableMapping</div><div><br class=""></div><div>The only exceptions are Configuration and Row. I did not feel like I should have named them more precisely because both types are very locally and contextually used. Conflict with user types is possible, but an explicit scoping with the module name is not too costly. That’s a feeling I can rationalize, but mainly it has not been (yet)&nbsp;contradicted by experience.</div><div><br class=""></div><div>Record and Persistable are arguably database-ish enough for being kind of self-documenting without any further prefixing.</div><div><br class=""></div><div>So, no, I don’t think prefixes are mandatory, or even should be generally recommended. Third-party libraries need their author to avoid likely naming conflicts. BTW, it’s an interesting sub-topic of the discussion about the very general Either and Result types: I can understand why some don’t feel well when they expose such a type in their library, and why they ask for a standard one.</div><div><br class=""></div><div>Now, Foundation is a different story, because both Foundation and the Swift Standard Library want to provide basic needs. I would not be disappointed if Foundation would keep the NS prefix, so that the Swift Standard Library has room to expand. Just as Set was eventually introduced as an alternative to NSSet, regular expressions, paths manipulation, trees, etc. are all basic types that will be happy having a blessed Swift version in the future.</div><div><br class=""></div><div>Gwendal</div><div><br class=""></div></body></html>