[swift-evolution] Ability to pack, order and align certain types of Structs (like in C)

Hitster GTD hitstergtd at gmail.com
Fri Apr 8 09:59:55 CDT 2016


Chris,

Thanks for supporting it in principle. I understand that it is out of
scope for Swift 3 and that using C is one of the only decent
workarounds at the moment.

However, since you concur with what is being requested, would it be OK to:

(a) Draft a summary proposal and commit it to the swift-evolution@
repository, perhaps under "Other Proposals" or "Post v3"? and/or
(b) Add some notes under docs/, perhaps in docs/LibraryEvolution.rst
regarding this topic?

I am uncertain as to what happens after Swift 3 since there don't seem
to be any guidelines for that; hopefully the above would ensure that
it isn't forgotten. :)

On 8 April 2016 at 07:01, Chris Lattner <clattner at apple.com> wrote:
>
>> On Apr 7, 2016, at 12:28 PM, hitstergtd+swiftevo--- via swift-evolution <swift-evolution at swift.org> wrote:
>>
>> To the community:
>>
>> Neither am I a compiler/language design expert nor have I previously
>> written a proposal to that effect, so I apologise if I have
>> trivialised the matter especially with regard to other parts of Swift
>> or if some of it already exists. I am also aware that what I've
>> proposed herein maybe possible through alternate means. However, the
>> aim of this is to make it a first-class feature in Swift itself. For
>> those unfamiliar with what is being requested, please see [2], [5] and [8].
>>
>> I have also filed this as a language feature request at [7].
>
> Yes, this would be a great thing to have, but it requires significant design and implementation work, so I’m afraid it is out of scope for Swift 3.  In the meantime, a lame workaround is that you can define your struct in C and import it.  Swift will honor the layout of the C type.
>
> -Chris


More information about the swift-evolution mailing list