[swift-evolution] Renaming SwiftObject

Saagar Jha saagar at saagarjha.com
Sat Jan 6 21:21:02 CST 2018


Just my 2¢, from the point of view of someone runs into SwiftObject frequently: I’d really appreciate it if this class had “Swift” in it’s name. At first glance, it’s name in mangled form (“_TtCs7_Object”) gives no indication as to where it’s from. Obviously it’s not a “pure” Objective-C object, but it’s not clear that it’s a Swift object either–maybe it’s C++? Saagar’s cool new language that also does name mangling? Who knows. I guess “_T” is kind of enough to figure it out, but since you’re changing the name anyways it would be great if it was something that reduced my cognitive overload, like Swift._SwiftObject.

If you’re going to expose this to Swift as well, a similar argument applies: from it’s name, it’s not clear that it’s part of Objective-C interop. I’m not sure if this is visible to Swift programmers, and if it isn’t this isn’t an issue, but in the case that it is Swift._Object looks more like a private implementation detail of a base class akin to NSObject in Objective-C or Object in Java than a compatibility shim with Objective-C.

Saagar Jha

> On Jan 4, 2018, at 19:10, Greg Parker via swift-evolution <swift-evolution at swift.org> wrote:
> 
> SwiftObject is an Objective-C class that is the base class of all "pure Swift" class types. It needs to be renamed for the Swift stable ABI in order to avoid ObjC class name collisions between the stable ABI's Swift runtime and the runtime embedded into existing Swift apps.
> 
> I suggest `Swift._Object`, mangled as _TtCs7_Object like other Swift ObjC class names. 
> 
> Any comments?
> 
> https://github.com/apple/swift/pull/13748 <https://github.com/apple/swift/pull/13748>
> 
> 
> -- 
> Greg Parker     gparker at apple.com <mailto:gparker at apple.com>     Runtime Wrangler
> 
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20180106/b6602cac/attachment.html>


More information about the swift-evolution mailing list