# SE-0400: Init Accessors

**URL:** <https://forums.swift.org/t/se-0400-init-accessors/65583>\
**Category:** Proposal Reviews\
**Created:** [June 14, 2023, 9:53pm UTC](https://forums.swift.org/t/se-0400-init-accessors/65583 "2023-06-14T21:53:37Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Jumhyn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jumhyn/32/3891_2.png) [@Jumhyn](https://forums.swift.org/u/Jumhyn)\
**Post date:** [June 14, 2023, 11:36pm UTC](https://forums.swift.org/t/se-0400-init-accessors/65583/11 "2023-06-14T23:36:18Z")

</div>

Taking off my review manager hat for a moment, I have a few thoughts/questions:

- I agree with @DevAndArtist's comment from the pitch thread:

- I still don't like the restriction that the ability to synthesize a memberwise init depends on the relative ordering of properties and their `accesses` clauses. Since `accesses` clauses can only refer to stored properties there's no chance of cycle, and IMO we should synthesize a memberwise init with the parameters matching source order but with properties initialized in dependency order (ties broken by source order).

- To Jordan's point above:

ETA:

- Does invoking the setter of a stored property in an `init` accessor (can you do this?) invoke the `didSet` observer? IIRC the current rule is that setters called inside `init` never call `didSet`, seems like we should extend that to `init` accessors.

> [@tourultimate](#):
>
> Also, a nice simplification might be to have the ability to bundle the init and set accessor so for less boilerplate where init/set have the same logic:
> 
> ```swift
> struct Angle {
> var degrees: Double
> var radians: Double {
> get { degrees * .pi / 180 }
> set init initializes(degrees) { degrees = newValue * 180 / .pi }
> }
> ...
> }
> 
> ```

I noted myself as weakly against this direction in the pitch, but I think one thing to consider with the new syntax that puts the `initializes` and `accesses` clauses _outside_ the `init` clause, a future direction which allows combining the `init` and `set` accessors is IMO significantly more awkward (it's not clear that `initializes` really only applies to the `init` and not the `set`). I guess you could just learn this, but it's something to consider...

---

_[View the full topic](https://forums.swift.org/t/se-0400-init-accessors/65583)._
