[swift-evolution] Pitch: really_is and really_as operators
Xiaodi Wu
xiaodi.wu at gmail.com
Wed Aug 24 22:17:07 CDT 2016
On Wed, Aug 24, 2016 at 10:07 PM, Charles Srstka <cocoadev at charlessoft.com>
wrote:
> On Aug 24, 2016, at 10:00 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
>
>
> On Wed, Aug 24, 2016 at 9:58 PM, Charles Srstka <cocoadev at charlessoft.com>
> wrote:
>
>> On Aug 24, 2016, at 9:51 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
>>
>> On Wed, Aug 24, 2016 at 9:47 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
>>
>>> Works on Linux :)
>>>
>>
>> And besides, on any platform where `type(of: bar) != NSString`, why
>> should you expect `bar really_is NSString == true`? Isn't bar *not really*
>> NSString?
>>
>>
>> Because the pitch was for a version of ‘is’ which lacks the Objective-C
>> bridging. The ‘is’ keyword matches subclasses of the type you specify as
>> well as the type itself.
>>
>
> Sorry, I corrected myself :) I neglected the part where you mentioned that
> __NSCFString is a subclass of NSString (which I forgot was the case). But
> as you can see, `type(of: bar) is NSString.Type` works just fine :)
>
>
> Yeah, it does; thanks. I thought that ‘is’ on the type would be
> compromised in the same way as it normally is, so it’s good to know that
> there’s a way to make it honest. I still hate the bridging, and wish that
> SE-0083 were not apparently dead, but grumble grumble grumble, at least
> there’s a workaround. Is this documented anywhere?
>
This is where I'm out of my depth, but I'll take a stab at it:
I _think_ the metatype itself is bridgeable, but it can't lie about the
type-of-which-the-metatype-is-the-type.
> Charles
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160824/2ad44218/attachment.html>
More information about the swift-evolution
mailing list