# Renaming SwiftObject

**URL:** <https://forums.swift.org/t/renaming-swiftobject/7362>\
**Category:** Discussion\
**Created:** [January 5, 2018, 3:09am UTC](https://forums.swift.org/t/renaming-swiftobject/7362 "2018-01-05T03:09:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gparker42](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gparker42/32/373_2.png) [@gparker42](https://forums.swift.org/u/gparker42)\
**Post date:** [January 5, 2018, 3:09am UTC](https://forums.swift.org/t/renaming-swiftobject/7362/1 "2018-01-05T03:09:57Z")

</div>

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>
>
> SwiftObject needs to be renamed to avoid ObjC class name collisions between
> the …Swift stable ABI and older Swift apps.
> 
> rdar://35554345

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

---

<div class="post-metadata">

**Author:** ![fclout](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/fclout/32/36155_2.png) [@fclout](https://forums.swift.org/u/fclout)\
**Post date:** [January 5, 2018, 3:21am UTC](https://forums.swift.org/t/renaming-swiftobject/7362/2 "2018-01-05T03:21:01Z")

</div>

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](https://github.com/apple/swift/pull/13748)
> > 
> > --  
> > 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](https://lists.swift.org/mailman/listinfo/swift-evolution)

---

<div class="post-metadata">

**Author:** ![saagarjha](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@saagarjha](https://forums.swift.org/u/saagarjha)\
**Post date:** [January 7, 2018, 3:21am UTC](https://forums.swift.org/t/renaming-swiftobject/7362/3 "2018-01-07T03:21:02Z")

</div>

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](https://github.com/apple/swift/pull/13748)
> > 
> > --  
> > 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](https://lists.swift.org/mailman/listinfo/swift-evolution)

---

<div class="post-metadata">

**Author:** ![xwu](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@xwu](https://forums.swift.org/u/xwu)\
**Post date:** [January 5, 2018, 3:31am UTC](https://forums.swift.org/t/renaming-swiftobject/7362/4 "2018-01-05T03:31:16Z")

</div>

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](https://github.com/apple/swift/pull/13748)
> > 
> > --  
> > Greg Parker gparker@apple.com Runtime Wrangler
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > swift-evolution mailing list  
> > swift-evolution@swift.org  
> > [https://lists.swift.org/mailman/listinfo/swift-evolution](https://lists.swift.org/mailman/listinfo/swift-evolution)
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > swift-evolution mailing list  
> > swift-evolution@swift.org  
> > [https://lists.swift.org/mailman/listinfo/swift-evolution](https://lists.swift.org/mailman/listinfo/swift-evolution)

---

<div class="post-metadata">

**Author:** ![gparker42](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/gparker42/32/373_2.png) [@gparker42](https://forums.swift.org/u/gparker42)\
**Post date:** [January 8, 2018, 11:00pm UTC](https://forums.swift.org/t/renaming-swiftobject/7362/5 "2018-01-08T23:00:14Z")

</div>

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](https://github.com/apple/swift/pull/13748)
> > > 
> > > --  
> > > 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](https://lists.swift.org/mailman/listinfo/swift-evolution)

---

<div class="post-metadata">

**Author:** ![saagarjha](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@saagarjha](https://forums.swift.org/u/saagarjha)\
**Post date:** [January 9, 2018, 8:00am UTC](https://forums.swift.org/t/renaming-swiftobject/7362/6 "2018-01-09T08:00:25Z")

</div>

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](https://github.com/apple/swift/pull/13748)
> > > > 
> > > > --  
> > > > 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](https://lists.swift.org/mailman/listinfo/swift-evolution)
