Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flexible memberwise initialization #76

Merged

Conversation

anandabits
Copy link
Contributor

No description provided.


2. Sometimes mutable properties that have a sensible default value are simply default-initialized and the same post-initialization configuration strategy is employed when the default value is not correct for the intended use. This results in an instance which may pass through several states that are incorrect *for the intended use* before it is correctly initialized for its intended use.

Underlying this problem is the fact initialization scales with M x N complexity (M members, N initializers). We need as much help from the compiler as we can get!
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: Shouldn't this be the following?

Underlying this problem is the fact that initialization scales...

@lattner
Copy link
Collaborator

lattner commented Dec 27, 2015

Looks good, please squash it into one patch and I'll commit it!

added example for lazy properties

correct typos and small omissions

added link to Swift Evolution thread

fix initialzier typo

Significant rewrite

The programmer and implementation models have received major revisions to improve clarity and simplify implementation.

Third draft

Remove changes to existing initialization rules.
Add @default attribute enabling let properties to supply a default value for their initialization parameter.
Move @nomemberwise to future enhancement.
Fix mistakes in examples and other typos.

typo fix

Refined to focus on core functionality

1. Moved @default to future enhancement.
2. Moved initializer chaining to future enhancement.
3. Clarified impact on existing code and the implicit memberwise initializer.

Specify Chris Lattner as review manager

Typo fixes, clarifications, and slight redundancy reduction.

Fix typos and fill out access control alternatives

The primary change is a fleshing out of the rationale for the access control design choice made in this proposal under the alternative "Allow parameters to be synthesized for properties with a lower access level than the initializer".

Access control refinements and typo fix

1. Clarify eligibility of properties with distinct setter access control.
2. Refine access control of implicitly generated memberwise initializer.
3. Add future enhancement to allow distinct access control for memberwise initialization eligibility.
@anandabits anandabits force-pushed the flexible-memberwise-initialization branch from 800b5b5 to a26e09b Compare December 28, 2015 03:36
@anandabits
Copy link
Contributor Author

Thanks Chris. I believe I have squashed them properly now!

I made a few further refinements to the interaction with access control you might want to review:

  1. Clarify eligibility of properties with distinct setter access control.
  2. Refine access control of implicitly generated memberwise initializer.
  3. Add future enhancement to allow distinct access control for memberwise initialization eligibility.

lattner added a commit that referenced this pull request Dec 28, 2015
@lattner lattner merged commit 658c92e into swiftlang:master Dec 28, 2015
@lattner
Copy link
Collaborator

lattner commented Dec 28, 2015

Awesome! We'll open the discussion period early next year, most likely the week of Jan 4th. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants