Marin Todorov@icanzilb·Jun 28, 2017🎉 Finally, finally found use for defer. You can force a didSet to fire from within a class init like so 🎉15119323
Marin Todorov@icanzilb·Jun 28, 2017nope. init does not trigger didSet blocks. defer means your code will be executed after init has finished, which is okay22
Jaden Geller @JadenGeller·Jun 28, 2017It is executed after the body of init, but it is still part of init... this really feels like a bug. //cc @jckarter25
Jaden Geller @JadenGeller·Jun 28, 2017Oh wait, I don't think he's on twitter anymore... @UINT_MIN maybe?13
Jordan Rose@UINT_MIN·Jun 28, 2017Hrm. I'd say it's a bug—comes from implementing defer on top of closures. If you want didSet behavior in init, call a helper method.215
Nacho Soto@NachoSoto·Jun 28, 2017Uh oh, I've been relying on this for a while. I'm glad we wrote a test at KA to ensure this behaviour didn't disappear @andy_matuschak 😅14
Andy Matuschak@andy_matuschak·Jun 28, 2017Haha oh man I expected this to go away at some point. Good! I feel this was a wart on the language semantics.13
Russ Bishop@xenadu02·Jun 28, 2017I discussed this with @pathofshrines once, wanted to opt properties in under certain constraints. IIRC prop behaviors was the great hope1
Andy Matuschak@andy_matuschakReplying to @xenadu02 @NachoSoto and 6 othersSure, yeah, I’d be interested in some intentional way to explicitly indicate “yo please treat this like a post-init setter”10:16 PM · Jun 28, 2017·Twitter for Mac4 Likes
Marin Todorov@icanzilb·Jun 28, 2017Replying to @andy_matuschak @xenadu02 and 6 otherswell, it's official. I once again have no use for defer in my life 😂18