[swift-evolution] [Proposal] Partial initializers

Slava Pestov spestov at apple.com
Thu Jan 21 23:16:48 CST 2016


> On Jan 21, 2016, at 11:44 AM, Matthew Johnson <matthew at anandabits.com> wrote:
> 
>> 
>> On Jan 20, 2016, at 11:10 PM, Slava Pestov <spestov at apple.com <mailto:spestov at apple.com>> wrote:
>> 
>> 
>>> On Jan 20, 2016, at 8:55 PM, Jordan Rose <jordan_rose at apple.com <mailto:jordan_rose at apple.com>> wrote:
>> 
>>> IIRC mandatory inlining runs after DI. I think Chris didn't want cases where the DI looked wrong but was correct because the called function happened to be inlined—there's no indication at the call site of this.
>> 
>> I don’t think that’s a huge problem though. When we emit a diagnostic about an uninitialized value or use, we could also emit a series of ‘inlined from here’ notes.
>> 
>>> 
>>> We also wouldn't want the other semantics of transparent <https://github.com/apple/swift/blob/master/docs/TransparentAttr.rst>: no debug info,
>> 
>> That sounds unfortunate. Why is debug info with transparent functions any more of an issue than debug info for stuff inlined by the optimizer passes? I’m assuming we emit debug info for the latter.
>> 
>>> and restrictions on what can be mentioned if it's marked public.
>>> 
>> 
>> Arguably, public partial inits only make sense for @_fixed_layout structs anyway :-)
> 
> I don’t understand that comment.  What is the argument that they only make sense for @_fixed_layout structs?  It feels like a generally useful feature to me.

It seems partial initializers leak out what the stored properties of a type are to callers. Resiliently adding stored properties or changing stored properties into computed properties seems like it might cause difficulties for existing code that makes use of partial initializers. It is not clear to me what the guidelines would be for evolving partial initializers.

If this doesn’t make sense to you, take a look at Jordan’s docs/LibraryEvolution.rst — but also keep in mind that outside of system frameworks, all value types are implicitly @_fixed_layout.

Slava

> 
>> 
>>> Jordan
>> 
>> Slava

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160121/6e5e078b/attachment.html>


More information about the swift-evolution mailing list