> On Aug 25, 2016, at 9:34 AM, Douglas Gregor wrote:
> I’d thought we were going to get some warnings when putting an optional into
> an Any that would end up going into Objective-C, but I don’t see the warning:
> maybe Joe can weigh in as to why we didn’t do that.
Warning
For what it’s worth, I’m very much behind this proposal. +1
> On 24 Aug 2016, at 00:36, Douglas Gregor via swift-evolution
> wrote:
>
> Introduction
>
> Optionals can be used as values of the type Any, but only bridge as opaque
> objects in Objective-C. We should
> On Aug 24, 2016, at 6:27 PM, Greg Parker wrote:
>
>
>> On Aug 23, 2016, at 3:36 PM, Douglas Gregor via swift-evolution
>> > wrote:
>>
>> Proposed solution
>>
>> When an Optional value is bridged to an
> On Aug 24, 2016, at 10:40 PM, jaden.gel...@gmail.com wrote:
>
> Why is exposing an Optional as an opaque box less error prone than an NSNull?
> That doesn't seem obviously true to me.
Firstly, to answer your question: It is less error-prone because the error is
more obvious. If an
> The problem is that NSNull is in fact rare in Cocoa.
I couldn't agree more. I think this proposal is quite dangerous for (often
legacy) Objective C codebases where checking for NSNull is not common
practice. Since Optionals are not a construct in Objective C, I don't see
any reason for why
> On Aug 25, 2016, at 5:00 AM, Charles Srstka via swift-evolution
> wrote:
>
>> On Aug 24, 2016, at 8:27 PM, Greg Parker via swift-evolution
>> > wrote:
>>
>>> On Aug 23, 2016, at 3:36 PM, Douglas Gregor
Why is exposing an Optional as an opaque box less error prone than an NSNull?
That doesn't seem obviously true to me.
> On Aug 24, 2016, at 8:00 PM, Charles Srstka via swift-evolution
> wrote:
>
>>> On Aug 24, 2016, at 8:27 PM, Greg Parker via swift-evolution
>>>
> On Aug 24, 2016, at 8:27 PM, Greg Parker via swift-evolution
> wrote:
>
>> On Aug 23, 2016, at 3:36 PM, Douglas Gregor via swift-evolution
>> > wrote:
>>
>> Proposed solution
>>
>> When an Optional
> On Aug 23, 2016, at 3:36 PM, Douglas Gregor via swift-evolution
> wrote:
>
> Proposed solution
>
> When an Optional value is bridged to an Objective-C object, if it contains
> some value, that value should be bridged; otherwise, NSNull or another
> sentinel
I'd imagine an implementation something like this (but, in the bridging logic,
not as a top level function…):
func dynamicCast(_ array: [Any]) -> [T?] {
var _type: CollectionCastType?
func assertType(_ checkType: CollectionCastType) {
guard let type = _type else {
First of all, I'm really happy with this proposal so far. I really appreciate
the work that's been done to improve Swift and Objective-C interoperability.
Now, question: Does this proposal also improve bridging from Objective-C to
Swift or only the other direction? For example, let's say an
> On Aug 24, 2016, at 4:16 AM, David Rönnqvist
> wrote:
>
> I have some problems understanding the scope of this proposal. More
> specifically if it’s limited to arrays and dictionaries or if it’s broader
> than that, and if it’s limited to objects that originate
I have some problems understanding the scope of this proposal. More
specifically if it’s limited to arrays and dictionaries or if it’s broader than
that, and if it’s limited to objects that originate in Swift or if the same
applies for objects that originate in Objective-C code.
For me, it
Introduction
Optionals can be used as values of the type Any, but only bridge as opaque
objects in Objective-C. We should bridge Optionals with some value by bridging
the wrapped value, and bridge nils to the NSNull singleton.
Swift-evolution thread: TBD
14 matches
Mail list logo