> On Aug 18, 2015, at 5:19 PM, Quincey Morris > <quinceymor...@rivergatesoftware.com> wrote: > > But, in my own defense, I was looking for verification first that the > mechanism is safe in 100% pure Swift. The next thing to verify is whether > it’s safe with an @objc base class in Swift. Only if both those things are > safe does it make any sense to wonder if an Obj-C base class is safe. > > However, the test you did doesn’t give much cause for optimism. I suppose > *selectors* would have to be namespaced to solve the problem for the Obj-C > runtime, wouldn’t it? For compatibility reasons, that seems unlikely, which > makes it unlikely that this problem will ever be solved for Cocoa frameworks.
Hey, you know what *does* work? Going back to the original test: MyBaseClass.h: #import <Foundation/Foundation.h> @interface MyBaseClass : NSObject - (void)foo; @end MyBaseClass.m (initially): @implementation MyBaseClass - (void)foo { fprintf(stderr, "BOOM!\n"); } @end App code: import MyFramework class MyClass: MyBaseClass { @nonobjc func bar() { print("BLEAH!") } } let obj = MyClass() obj.foo() Output: BOOM! MyBaseClass.m changed to: #import "MyBaseClass.h" @implementation MyBaseClass - (void)foo { fprintf(stderr, "BOOM!\n"); [self bar]; } - (void)bar { fprintf(stderr, "It actually succeeded at Not Being Seen\n"); } @end Output without recompiling: BOOM! It actually succeeded at Not Being Seen Output after recompiling the app: BOOM! It actually succeeded at Not Being Seen And reverting MyBaseClass.m to the original and not recompiling the app: BOOM! So, if you declare all your new methods as @nonobjc and the base class remains written in Objective-C, any new private method added to the base class will be concealed extremely well. However, we happen to know, it's in the water barrel. (“BOOM!”) Charles _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com