Renaming SwiftObject

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?

···

--
Greg Parker gparker@apple.com <mailto:gparker@apple.com> Runtime Wrangler

I'll bite. Shouldn't that name encode that it's an Objective-C object? Like Swift.ObjCBase?

···

Le 4 janv. 2018 à 22:10, Greg Parker via swift-evolution <swift-evolution@swift.org> a écrit :

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?

[runtime] Rename class SwiftObject to Swift._SwiftObject. by gparker42 · Pull Request #13748 · apple/swift · GitHub

--
Greg Parker gparker@apple.com <mailto:gparker@apple.com> Runtime Wrangler

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

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@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?

[runtime] Rename class SwiftObject to Swift._SwiftObject. by gparker42 · Pull Request #13748 · apple/swift · GitHub

--
Greg Parker gparker@apple.com <mailto:gparker@apple.com> Runtime Wrangler

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

If it’s the base class for all Swift class types, I think “SwiftObject” is
ideal and the proposed renaming is sensible. What does it matter that it’s
an Obj-C object? Why does that have to be in the name? Let’s not bikeshed
this and keep it simple.

···

On Thu, Jan 4, 2018 at 22:21 Félix Cloutier via swift-evolution < swift-evolution@swift.org> wrote:

I'll bite. Shouldn't that name encode that it's an Objective-C object?
Like Swift.ObjCBase?

Le 4 janv. 2018 à 22:10, Greg Parker via swift-evolution < > swift-evolution@swift.org> a écrit :

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?

[runtime] Rename class SwiftObject to Swift._SwiftObject. by gparker42 · Pull Request #13748 · apple/swift · GitHub

--
Greg Parker gparker@apple.com Runtime Wrangler

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

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@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@swift.org <mailto:swift-evolution@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?

[runtime] Rename class SwiftObject to Swift._SwiftObject. by gparker42 · Pull Request #13748 · apple/swift · GitHub

--
Greg Parker gparker@apple.com <mailto:gparker@apple.com> Runtime Wrangler

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution

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@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@saagarjha.com <mailto:saagar@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@swift.org <mailto:swift-evolution@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?

[runtime] Rename class SwiftObject to Swift._SwiftObject. by gparker42 · Pull Request #13748 · apple/swift · GitHub

--
Greg Parker gparker@apple.com <mailto:gparker@apple.com> Runtime Wrangler

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution