Shouldn&#39;t NSUInteger always become UInt in swift?<br><div class="gmail_quote"><div dir="ltr">On Thu, Feb 2, 2017 at 12:07 AM Freak Show via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg">I have a framework I wrote that maps Objective C objects to sqlite records - deriving sqlite schema definitions from property definitions.  You simply derive model classes from my base class Model and the base class will introspect the properties and handle all the sql for you.  A little like CoreData but the property definitions are used for the meta model instead of an external model file and it is a lot leaner and natural feeling.<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I picked NSUInteger for the auto incremented primary key because, after all, it would never go negative.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">However, when I tried to import this framework into Swift and use Model as a base class for a Swift class, I found it nearly impossible to satisfy the compiler about mixed mode comparisons and ultimately changed the type to NSInteger.  </div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I was not happy about it and if I wasn&#39;t the framework author I would have thought harder about changing it.</div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On Feb 1, 2017, at 17:29, Jordan Rose via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br class="m_-6810131628934015108Apple-interchange-newline gmail_msg"><div class="gmail_msg"><div style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><b class="gmail_msg">find out how Objective-C projects are using NSUInteger in their headers:</b></div><div style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg"><br class="gmail_msg"></div><div style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg">- Do they have no NSUIntegers at all?</div><div style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg">- Are they using NSUInteger because they’re overriding something that used NSUInteger, or implementing a protocol method that used NSUInteger?</div><div style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg">- Are they using NSUInteger as an opaque value, where comparisons and arithmetic are uninteresting?</div><div style="font-family:Helvetica;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class="gmail_msg">- Are they using NSUInteger as an index or count of something held in memory?</div></div></blockquote></div><br class="gmail_msg"></div></div></div>_______________________________________________<br class="gmail_msg">
swift-evolution mailing list<br class="gmail_msg">
<a href="mailto:swift-evolution@swift.org" class="gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="gmail_msg">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="gmail_msg">
</blockquote></div>