[swift-users] unsafeBitCast to Unimplemented Class
Dave Abrahams
dabrahams at apple.com
Tue Feb 7 17:44:06 CST 2017
on Mon Feb 06 2017, Andrew Trick <swift-users-AT-swift.org> wrote:
>> On Feb 6, 2017, at 8:51 PM, Dave Abrahams <dabrahams at apple.com> wrote:
>>
>>
>> on Mon Feb 06 2017, Andrew Trick <atrick-AT-apple.com> wrote:
>>
>
>>> Is a missing declaration a use case that needs to be supported?
>>
>> I couldn't say.
>>
>>> Wouldn’t it be more proper to use selector based dispatch in those
>>> cases?
>>
>> Example, please? I don't know what that means, though I probably should.
>>
>> --
>> -Dave
>
> I phrased that as a question because I'm the last person who should be
> giving advice here... What I had in mind is this:
>
> if ([self isKindOfClass:NSClassFromString(@“Bar”)]) {
> self.perform(@selector(FakeBarProtocol.foo))
> }
>
> It's not type safe, but it's a lot better than outright lying about
> the reference's dynamic type.
Presumably there's a way to express that in Swift, but if it uses
varargs I expect it's pretty darned inefficient.
--
-Dave
More information about the swift-users
mailing list