<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="">Le 19 nov. 2016 à 15:58, Alan Cabrera via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><div class="">I’m not sure if this was proposed or not; or even if this is a Swift-ly way of doing things. &nbsp;It would be pretty handy to be able to declare init() functions in my module to register handlers. &nbsp;It’s a common pattern in enterprise software.<br class=""><br class="">Currently, I have to generate a lot of boilerplate code to emulate the behavior. &nbsp;I think it would be cleaner to have these global init() functions.<br class=""><br class=""></div></div></blockquote><br class=""></div><div>I’d rather like a swift attribute equivalent to :&nbsp;<span class="pln" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; color: rgb(48, 51, 54);">__attribute__</span><span class="pun" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; color: rgb(48, 51, 54);">((</span><span class="kwd" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; color: rgb(16, 16, 148);">constructor</span><span class="pun" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; color: rgb(48, 51, 54);">))</span></div><div><span class="pun" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit; font-size: 13px; margin: 0px; padding: 0px; border: 0px; color: rgb(48, 51, 54);"><br class=""></span></div><div><span class="pun" style="white-space: inherit; margin: 0px; padding: 0px; border: 0px;">It will not force me to call my initializer init, and moreover it will let me declare multiple functions so I would be able to register multiples handlers from a single module without having to group all the register call into a single init() function.</span></div><div><br class=""></div></body></html>