[swift-evolution] Pre-proposal: Convert reference params to tuples

Charles Srstka cocoadev at charlessoft.com
Wed Dec 23 14:12:32 CST 2015

> 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.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151223/4babc4ec/attachment.html>

More information about the swift-evolution mailing list