Re: [swift-dev] Initialization of default values

2015-12-11 Thread Douglas Gregor via swift-dev
> On Dec 11, 2015, at 7:34 PM, Matthew Johnson wrote: > > Thanks Jordan. I was guessing a synthesis like this was happening but didn't > want to assume without asking. > > Is the initialization of members with initial values synthesized at the > beginning of the initializer body before any u

Re: [swift-dev] Initialization of default values

2015-12-11 Thread Matthew Johnson via swift-dev
Thanks Jordan. I was guessing a synthesis like this was happening but didn't want to assume without asking. Is the initialization of members with initial values synthesized at the beginning of the initializer body before any user code? If not, at what point in the initializer does this happen

Re: [swift-dev] Initialization of default values

2015-12-11 Thread Jordan Rose via swift-dev
Members with initial values get their initialization synthesized into the body of the type's initializer. I think we do this during SILGen, i.e. when we go to emit a SIL body for the ConstructorDecl AST node. (We use the term "initial value" for "the thing on the right side of the equal sign fo

Re: [swift-dev] Initialization of default values

2015-12-11 Thread Matthew Johnson via swift-dev
Thanks Doug, that makes sense. I was wondering if Joe's answer might have been referring to arguments with defaults. What are you doing for members with default values specific (and therefore not initialized by code in an initializer)? Do you plan changes to this as well? Matthew Sent fr

Re: [swift-dev] Initialization of default values

2015-12-11 Thread Douglas Gregor via swift-dev
> On Dec 10, 2015, at 10:13 AM, Matthew Johnson wrote: > > Thanks Joe. It sounds like in both current state and future state the > compiler synthesizes additional arguments to the initializers for the type. > Is that correct? > > Doug and Jordan, if you’re able to offer any additional insig

Re: [swift-dev] Initialization of default values

2015-12-10 Thread Joe Groff via swift-dev
> On Dec 9, 2015, at 3:28 PM, Matthew Johnson via swift-dev > wrote: > > I am working on a proposal for flexible memberwise initialization and would > like to understand how Swift currently handles initialization of members that > have a default specified in the declaration when an initialize