[swift-evolution] Pre-proposal: Convert reference params to tuples
Kenny Leung
kenny_leung at pobox.com
Sat Jan 9 19:52:04 CST 2016
How would this work on the stack? I imagine returning a value in a tuple would make it a completely different location on the stack than where the original parameter would be where the ObjC side would be expecting it. This would break the calling convention.
-Kenny
> On Dec 23, 2015, at 12:12 PM, Charles Srstka via swift-evolution <swift-evolution at swift.org> wrote:
>
>> On Dec 23, 2015, at 5:11 AM, Tino Heth <2th at gmx.de> wrote:
>>
>> Imho it sounds good, but I rarely encounter situations where I would benefit from the proposed change…
>
> It does happen in the Objective-C frameworks; the NSURL example I provided is an aggravatingly common one, but there are plenty others (particularly anything that begins with “get”). In C, of course, it’s all over the place.
>
> It would be handy for third-party code, as well. I’m currently converting a class hierarchy from Obj-C to Swift that returns multiple values, but since this code still has to be interoperable with Obj-C (for now), I can’t move it to returning a tuple yet, and all these UnsafeMutablePointers are driving me *crazy*.
>
>> and afair "out" is an Objective-C addition, so there would be no improvement for plain C.
>
> While that’s true, Apple could use the same sort of solution that they have done in many other places; just use #ifdef checks to #define some constant like NS_OUT to ‘out’ for Objective-C, and to an empty string otherwise.
>
> Charles
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
More information about the swift-evolution
mailing list