<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 13 Apr 2017, at 06:20, Brent Royal-Gordon via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class="">On Apr 12, 2017, at 2:12 PM, Zach Waldowski via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">I want to disagree with this is strongly as possible lest it influence</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">the proposal in any way whatsoever. Just because you can solve something</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">through reflection doesn't mean you should.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote></div><div class=""><br class=""></div><div class="">Cosigned. Reflection is really cool, but it's generally going to be the least-efficient, most-buggy possible way to implement a given feature. There's something to be said for just...writing some code. Especially when the computer is writing it for you.</div><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-east-asian: normal; font-variant-position: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; border-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-stroke-width: 0px;"><div class=""><div style="font-size: 12px; " class="">--&nbsp;</div><div style="font-size: 12px; " class="">Brent Royal-Gordon</div><div style="font-size: 12px; " class="">Architechies</div></div></span>

</div>
<br class=""></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""><div class="">The computer writing it for you is good, but the compiler writing it for you is bad. For one thing, it’s less easy to debug source code that isn’t written anywhere.</div><div class=""><br class=""></div><div class="">I continue to think this proposal would be better with some kind of attribute (“annotation” in javaspeak) to allow more principled code-generation. Or a "property behaviour”, if that’s intended to do the same thing.</div><div class=""><br class=""></div><div class="">It could possibly be built-in (like @NSManaged, @objc, lazy, etc):</div><div class=""><br class=""></div><div class="">struct MyThing: Codable {</div><div class="">&nbsp; &nbsp; @coded let id: Int64</div><div class="">&nbsp; &nbsp; let name: String</div><div class="">}</div><div class=""><br class=""></div><div class="">This proposal is optimised for POD types where everything is serialised and there is no danger of leaking private, disposable or otherwise non-persistable details.&nbsp;</div><div class="">Once you want to leave a field out, you’re back to the same-old boilerplate that every other serialisation framework faces. An attribute would help with that.</div><div class=""><br class=""></div><div class="">That’s just one of the issues with this proposal. Having some way to customise the key name is another; you could imagine the attribute could take a parameter - e.g. @coded(“thing_id”).</div><div class=""><br class=""></div><div class="">I’d certainly consider supporting a better proposal, but this one is too narrow in capabilities and imagination IMO.</div><div class=""><br class=""></div><div class="">- Karl</div></body></html>