Replies: 1 comment
-
I think the main issue is that class initialization is hard. 😆 So far, the solutions that I've explored leave me questioning whether the added complexity justifies itself. Here are a few of the challenges in designing a good solution:
I've considered approaches like code injection, builder patterns, and protocol-based solutions, and each introduced its own complexities and potential drawbacks. For classes, custom initializers may ultimately be the clearest and most maintainable approach—certainly I haven't yet figured out something better! Perhaps a path forward could be to gather more use cases and then design a class-specific experimental macro (i.e. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I want to be able to use
@MemberwiseInit
to do this:Potentially allow both
@MemberwiseInit(start:)
and@MemberwiseInit(end:)
to inject code on either end of the init, but I haven't thought it through too much.I'd love to hear your thoughts on this @gohanlon.
Beta Was this translation helpful? Give feedback.
All reactions