[swift-evolution] Proposal: helpers for initializing properties of same name as parameters

Chris Lattner clattner at apple.com
Sun Dec 6 17:01:56 CST 2015


> On Dec 6, 2015, at 7:41 AM, Matthew Johnson <matthew at anandabits.com> wrote:
> 
> Thanks for chiming in on this thread.  I definitely understand the desire to wait on features like this until post-Swfit 3 and possibly post-hygienic macros as well.
> 
> I would add to your list of memberwise initializer deficiencies the fact that it is “all or nothing”.  I’m wondering what you think of generalizing our “utterance” of the memberwise initializer in a way that allows the flexibility for the initializer itself to handle initialization of some of the members while allowing the compiler to generate the implementation for other members.  I described one idea for doing this in a post last night where I described an @initializable member attribute.  I’m not tied to that specific solution, but I do think it is highly desirable to have complier-generated memberwise initialization that is more flexible than an “all or nothing” solution.  What are your thoughts?

That would be great of course, but it depends on the details.  We’d need someone to make a specific proposal to hash out whether and how it can work.

-Chris


More information about the swift-evolution mailing list