[swift-evolution] Pitch: Remove `NonObjectiveCBase` and replace `isUniquelyReferenced` by `isUniquelyReferencedUnsafe`
aschwaighofer at apple.com
Sat Jul 16 22:36:38 CDT 2016
Thank you for the feedback. Answers online.
Sent from my iPhone
> On Jul 16, 2016, at 7:38 PM, Andrew Trick <atrick at apple.com> wrote:
>> On Jul 16, 2016, at 6:46 PM, Arnold Schwaighofer via swift-evolution <swift-evolution at swift.org> wrote:
>> Replace isUniquelyReferenced<T : NonObjectiveCBase> by isUniquelyReferencedUnsafe<T: AnyObject> and remove the NonObjectiveCBase class from the standard library.
> So we’ll have:
> - isUniquelyReferencedNonObjC(object): true iff object is uniquely referenced and NonObjC
> - isUniquelyReferencedUnsafe(object): true iff object is uniquely reference, assert NonObjC
> I’m going to be picky. The “Unsafe” suffix doesn’t make sense to me. If you think this is an unsafe API then it should be:
> But I don’t really see how it is unsafe in the usual sense. If you want to convey that the programmer needs to satisfy some precondition, which is not generally associated with unsafety, then it should be:
Makes sense to me. I think it is unsafe in the sense if you don't satisfy the precondition the resulting behavior is undefined in modes other than -Onone and not checked by a precondition predicate that traps.
I find it kind of nice to recognize a predicate by the 'is' prefix. All unsafe APIs start with the word unsafe though. I could not find an unsafe freestanding predicate.
[As the implementor of the underlying builtin you may remember that it is not actually undefined and will return a implementation defined value (false) for objc classes. But we might not want to guarantee this going forward.]
> Frankly, the type was a nicer way to do this, by I understand removing it from the API surface.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution