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

Rethink and simplify properties #163

Open
iccir opened this issue Jun 21, 2020 · 2 comments
Open

Rethink and simplify properties #163

iccir opened this issue Jun 21, 2020 · 2 comments
Milestone

Comments

@iccir
Copy link
Member

iccir commented Jun 21, 2020

Moving forward, properties are going to be simpler. This aligns with some long term goals of better taking advantage of ES6 classes.

  1. @property will always synthesize a backing ivar with a _ prefix.
  2. @synthesize goes away.
  3. @dynamic goes away.
  4. @observe is useful, but in practice we only use a single case (change + after). We also always call a single "update" method regardless of the changes.
@iccir
Copy link
Member Author

iccir commented Jun 29, 2020

Overview of new property system:

  1. @property always synthesizes a backing ivar.
  2. Ivars may no longer be manually defined. For ivars without public getter/setter methods, use the private attribute.
  3. Backing ivars are accessed as an identifier of (_ + property name) when inside of a method definition.
  4. The actual implementation of backing ivars (whether or not they exist as properties on an object) is left up to the compiler. The compiler may decide to removed the property as an optimization, or it may decide that a getter/setter can be inlined for performance reasons.
  5. As a result of 3, use of ivars from a category is now prohibited.
  6. As a result of 3, use of ivars from a subclass is now prohibited.
  7. Subclasses may not redefine properties. In practice, this is rarely an issue.

@iccir
Copy link
Member Author

iccir commented Jul 5, 2020

The --simple-ivars flag is now always true (not a change from 2.x, but a change from previous 3.0 builds)

iccir added a commit that referenced this issue Mar 1, 2023
iccir added a commit that referenced this issue Mar 9, 2023
@iccir iccir added this to the 3.0 milestone Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant