[swift-evolution] Renaming SwiftObject

Saagar Jha saagar at saagarjha.com
Tue Jan 9 02:00:25 CST 2018


Well, there’s always the option of Swift._NonObjcSwiftObject…but to be honest what this class looks like from the Swift side is much less of a concern to me. Getting “Swift” in the mangled name is probably good enough.

Saagar Jha

> On Jan 8, 2018, at 15:00, Greg Parker <gparker at apple.com> wrote:
> 
> Adding "Swift" to the mangled name is reasonable. The class is not ordinarily visible, so most of the time that people see it will be in potentially mangled contexts like crash logs.
> 
> I'm reluctant to put too much ObjC into the name, because this is the base class for classes that are *not* @objc. 
> 
> 
>> On Jan 6, 2018, at 7:21 PM, Saagar Jha <saagar at saagarjha.com <mailto:saagar at saagarjha.com>> wrote:
>> 
>> 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 <mailto: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 <mailto:swift-evolution at swift.org>
>>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
>> 
> 

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


More information about the swift-evolution mailing list