<div dir="ltr">On Mon, Dec 26, 2016 at 12:55 AM, Daniel Leping <span dir="ltr"><<a href="mailto:daniel@crossroadlabs.xyz" target="_blank">daniel@crossroadlabs.xyz</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Ok, an example:</div><div><br></div><div>func myFactory<T: DefaultConstructable>(c:T.<wbr>Type) -> T {</div><div>let t = T()</div><div><br></div><div>if let ini = t as? Initializable {</div><div>ini.initialize(self)</div><div>}</div><div><br></div><div>if let co = t as? ContextAware {</div><div>co.setContext(context)</div><div>}</div><div><br></div><div>//etc</div><div><br></div><div>return t</div><div class="HOEnZb"><div class="h5"><div>}</div><div></div></div></div></blockquote><div><br></div><div>So, users will need to conform to Initializable, ContextAware, etc. But you insist on compiler magic for DefaultConstructible?</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><div>On Mon, 26 Dec 2016 at 11:19 Daniel Leping <<a href="mailto:daniel@crossroadlabs.xyz" target="_blank">daniel@crossroadlabs.xyz</a>> wrote:<br></div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_-5169838607156867246gmail_msg">I'm not arguing for implicit conformance in general, but I'm telling that DefaultConstructable is the same basic level as AnyObject, which is conformed implicitly.</div><div class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></div><div class="m_-5169838607156867246gmail_msg">Shortly, I'm against implicit conformance in general. I'm positive with "automatic compiler magic" conformance to DefaultConstructable for any object having a default constructor as it really is a very basic stuff. Otherwise you will have to add explicit conformance to it in almost every class of yours (annoying).</div><div class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></div><div class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><div class="gmail_quote m_-5169838607156867246gmail_msg"><div class="m_-5169838607156867246gmail_msg">On Mon, 26 Dec 2016 at 11:14 Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="m_-5169838607156867246gmail_msg" target="_blank">xiaodi.wu@gmail.com</a>> wrote:<br class="m_-5169838607156867246gmail_msg"></div><blockquote class="gmail_quote m_-5169838607156867246gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_-5169838607156867246gmail_msg">On Mon, Dec 26, 2016 at 12:43 AM, Daniel Leping via swift-evolution <span class="m_-5169838607156867246gmail_msg"><<a href="mailto:swift-evolution@swift.org" class="m_-5169838607156867246gmail_msg" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br class="m_-5169838607156867246gmail_msg"><div class="gmail_extra m_-5169838607156867246gmail_msg"><div class="gmail_quote m_-5169838607156867246gmail_msg"><blockquote class="gmail_quote m_-5169838607156867246gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_-5169838607156867246gmail_msg">Thank you, Adam!</div></blockquote><div class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></div><div class="m_-5169838607156867246gmail_msg">Wait, are you arguing for implicit conformance or not?</div></div></div></div><div class="m_-5169838607156867246gmail_msg"><div class="gmail_extra m_-5169838607156867246gmail_msg"><div class="gmail_quote m_-5169838607156867246gmail_msg"><div class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></div><blockquote class="gmail_quote m_-5169838607156867246gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005HOEnZb m_-5169838607156867246gmail_msg"><div class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005h5 m_-5169838607156867246gmail_msg"><div class="m_-5169838607156867246gmail_msg"><div class="gmail_quote m_-5169838607156867246gmail_msg"><div class="m_-5169838607156867246gmail_msg">On Mon, 26 Dec 2016 at 11:12 Adam Nemecek via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="m_-5169838607156867246gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:<br class="m_-5169838607156867246gmail_msg"></div><blockquote class="gmail_quote m_-5169838607156867246gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg">> <span style="font-size:12.8px" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg">Swift doesn't do implicit conformance. It always has to be declared</span><br style="font-size:12.8px" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><span style="font-size:12.8px" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg">explicitly. I'm pretty sure Doug Gregor can explain why better than I</span><br style="font-size:12.8px" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><span style="font-size:12.8px" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg">could.</span><div class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><span style="font-size:12.8px" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"></span></div><div class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><span style="font-size:12.8px" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"></span></div></div><div class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><div class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><span style="font-size:12.8px" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg">I don't think Daniel was arguing for implicit conformance, he's saying that if it makes sense for an object to have a default constructor, it makes sense for it to conform to the protocol which I agree with 100%.</span></div></div><div class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><div class="gmail_extra m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><div class="gmail_quote m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg">On Sun, Dec 25, 2016 at 9:17 PM, Dave Abrahams via swift-evolution <span class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><<a href="mailto:swift-evolution@swift.org" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><blockquote class="gmail_quote m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">on Sun Dec 25 2016, Daniel Leping <<a href="mailto:swift-evolution@swift.org" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">> You are right, usually it's required to implement a protocol which is not a<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">> good approach. The best is plain objects which can be used independently of<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">> ORM if needed (as DTOs, i.e.).<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">> I was thinking of DefaultConstructable as a protocol automatically applied<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">> to any class/struct having a default init, which is really logical for<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">> me.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></span>Swift doesn't do implicit conformance. It always has to be declared<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">explicitly. I'm pretty sure Doug Gregor can explain why better than I<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">could.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><div class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><div class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374m_2766821119499066179m_-4530764108705073068h5 m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">> On Mon, 26 Dec 2016 at 9:41 Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">xiaodi.wu@gmail.com</a>> wrote:<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> On Sun, Dec 25, 2016 at 10:50 PM, Daniel Leping<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> <<a href="mailto:daniel@crossroadlabs.xyz" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">daniel@crossroadlabs.xyz</a>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> wrote:<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Ok, an example from ORM. You have an entity factory with a virtual (read,<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> overloadable in the subclasses) method populating the properties.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> DefaultConstructable is a great choice here. Otherwise you will have to<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> force the users of your ORM to implement a certain protocol, which you most<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> probably would like to avoid.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Sorry--I'm not very familiar with using Swift for ORM purposes. Why do you<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> want to avoid having your users conform to a certain protocol? Wouldn't the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> users of your ORM have to conform to `DefaultConstructible` then? I'm<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> looking at Swift ORMs, and all require users to conform to a protocol or<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> inherit from a base class, typically named `Model` or similar. From a quick<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Google search:<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> <a href="https://vapor.github.io/documentation/fluent/model.html" rel="noreferrer" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">https://vapor.github.io/<wbr>documentation/fluent/model.<wbr>html</a><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> <a href="https://github.com/blitzagency/amigo-swift" rel="noreferrer" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">https://github.com/<wbr>blitzagency/amigo-swift</a><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> In general I think the best showcase is generic factories.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> On Mon, 26 Dec 2016 at 9:02 Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">xiaodi.wu@gmail.com</a>> wrote:<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> On Sun, Dec 25, 2016 at 10:18 PM, Daniel Leping<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> <<a href="mailto:daniel@crossroadlabs.xyz" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">daniel@crossroadlabs.xyz</a>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> wrote:<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Usually it's a generic function that needs to return a value from some<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> other function or a default value (zero) in a case of some conditions.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Optional value is an arguable solution in quite some scenarios. Afaik,<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> sometimes it can be used for optional resolution.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Right, I'd agree that Optional is the idiomatic way to do it. Afaict,<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> there's not much you can do with a default value that you couldn't with<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> nil, unless you have some guarantee as to _what_ that default is; however,<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> I'd expect that in every case that you can rely on a guarantee about a<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> default value which would be more useful than nil, it's going to require<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> more specific knowledge of your type than an all-encompassing<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> `DefaultConstructible` can provide.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Also, generic factories. Widely used in ORM solutions.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Can you elaborate on this? Why is Optional not a solution here?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> As mentioned above, algorythmical stuff that requires Zero.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> I'm still not convinced there exist credible use cases that need to be<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> generic over both collections and floating point, for instance. In fact, in<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> my experience, there are few math-heavy algorithms where one can ignore<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> even the distinction between integers and binary floating point. By the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> time you get down to matrix math, you start to run into difficulties that<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> require separate implementations for Float and Double.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> On Mon, 26 Dec 2016 at 8:38 Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">xiaodi.wu@gmail.com</a>> wrote:<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Can you give some examples of what you used this approach to do?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> On Sun, Dec 25, 2016 at 9:49 PM, Daniel Leping<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> <<a href="mailto:daniel@crossroadlabs.xyz" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">daniel@crossroadlabs.xyz</a>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> wrote:<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> +1 to this approach. I remember I had to create it on my own for my<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> projects. Would be nice to have it out of the box.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> On Mon, 26 Dec 2016 at 8:11 Adam Nemecek via swift-evolution <<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> <a href="mailto:swift-evolution@swift.org" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">swift-evolution@swift.org</a>> wrote:<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> > Yes, those particular types have initializers that take no arguments.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> That does not address my question. You merely restated your initial<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> observation that many types in Swift have implemented `init()`.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Right, it's an empirical argument.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> > I didn't think the value returned by `init()` was regarded as any sort<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> of zero--or even any sort of "default." In fact, some types in Foundation<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> have a static property called `default` distinct from `init()`.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Let's not talk about those then. This would not apply to every single type<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> in existence, as I've stated previously.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> > It gives you something different every time. How can this be squared<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> with your stated motivation regarding concepts of zero and concepts of<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> equality?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Due to the fact that it's a resource, not a value. As I've stated above,<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> not all of this applies to types that are more resource-like.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> > Or, it's what you get because that's the most trivial possible string.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Quite simply, I do not think the designer of most types that implement<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> `init()` have paused to wonder whether the value that you get is the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> identity element associated with the most useful and prominent operation<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> that can be performed on that type. I certainly never have.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> This is an appeal to tradition.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> > The statement I wrote was in JavaScript, so I'm not sure what you mean<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> by returning an optional. `[].reduce((a, b) => a + b)` results in an<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> error in JavaScript. In Swift, such a function may also be implemented with<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> a precondition that the array is not empty and would not return an optional.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> I was talking about their analogous swift implementations.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> > Can you give an example of an algorithm dealing with tensors where you<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> would use a `DefaultConstructible` generic over all types that have<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> `init()`, as opposed to working with the existing `Integer`,<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> `FloatingPoint`, and other numerical protocols?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> If it's implemented as either nested collections or numbers.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> On Sun, Dec 25, 2016 at 6:00 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">xiaodi.wu@gmail.com</a>> wrote:<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> On Sun, Dec 25, 2016 at 7:30 PM, Adam Nemecek <<a href="mailto:adamnemecek@gmail.com" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">adamnemecek@gmail.com</a>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> wrote:<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> > Is it well settled, either in Swift or in C++/Rust/etc., that the value<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> returned by a default initializer/constructor is regarded as an identity<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> element or zero?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Int() == 0, String() == "" so to some extent by convention, a lot of types<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> have a default value as is.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Yes, those particular types have initializers that take no arguments. That<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> does not address my question. You merely restated your initial observation<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> that many types in Swift have implemented `init()`.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> I didn't think the value returned by `init()` was regarded as any sort of<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> zero--or even any sort of "default." In fact, some types in Foundation have<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> a static property called `default` distinct from `init()`. In Rust, the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Default trait requires a function called `default()`, which is documented<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> as being useful when you want "some kind of default value, and don't<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> particularly care what it is."<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> I was asking whether there's some understanding, of which I've been<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> unaware, that the result of `init()` (or the equivalent in other languages)<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> is expected to be some sort of zero or an identity element. I'm not aware<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> of any evidence to that effect. Are you?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> > Is the thread that I get by writing `let t = Thread()` some kind of zero<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> in any reasonable sense of the word?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> DefaultConstructibility makes less sense for types that represent some<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> sort of resource but make sense for things that are values. But even in<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> this case, Thread() gives you a default value for example if you are<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> working with a resizable collection of threads.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> It gives you something different every time. How can this be squared with<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> your stated motivation regarding concepts of zero and concepts of equality?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> A better question is why does thread currently implement a default<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> constructor?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> It's an initializer that takes no arguments, because none are needed for a<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> new thread. How else would you write it?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> > Do you mean to argue that for an integer the additive identity should be<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> considered "more prominent and useful" than the multiplicative identity?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> I'm not aware of any mathematical justification for such a conclusion.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> I do. The justification is that if I call the default constructor of Int<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> currently, I get the value of 0.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> This is backwards. Why do you believe that the value you obtain from<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> `init()` is intended to be an identity element at all, let alone the most<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> important one? (It's also circular reasoning. Since `init()` only ever<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> gives you one value at a time, by your reasoning it demonstrates that every<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> type must have one "more prominent and useful" identity, which is begging<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> the question.)<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Which means that the binary operation must be addition.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Based on the value of `Int.init()`, you conclude that addition of integers<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> is a "more prominent and useful" operation than multiplication? Again, this<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> is backwards. Rather, we know that each numerical type belongs to multiple<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> ring algebras; there is no basis for reckoning any as "more useful." Since<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> `init()` can only ever give us one value at a time, we know that `init()`<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> cannot give a value that is a meaningful default with respect to any<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> particular operation.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> If I call String() I get "" which is the identity of the + String<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> operation.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Or, it's what you get because that's the most trivial possible string.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Quite simply, I do not think the designer of most types that implement<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> `init()` have paused to wonder whether the value that you get is the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> identity element associated with the most useful and prominent operation<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> that can be performed on that type. I certainly never have.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> > Going to your original example, I should add: other languages provide a<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> version of `reduce` that doesn't require an initial result (for instance,<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> JavaScript). In JavaScript, `[1, 2, 3].reduce((a, b) => a + b)` uses the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> element at array index 0 as the initial result, and the accumulator<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> function is invoked starting with the element at array index 1. This is<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> precisely equivalent to having `reduce` use the additive identity as the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> default initial result when + is the accumulator function and the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> multiplicative identity when * is the accumulator function (with the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> accumulator function being invoked starting with the element at array index<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> 0). It does not require a DefaultConstructible protocol. What more<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> ergonomic solution could be implemented using a monoidic wrapper type?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> These two will have different signatures. The reduce you describe returns<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> an optional,<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> The statement I wrote was in JavaScript, so I'm not sure what you mean by<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> returning an optional. `[].reduce((a, b) => a + b)` results in an error<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> in JavaScript. In Swift, such a function may also be implemented with a<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> precondition that the array is not empty and would not return an optional.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> the other one would returns the default value.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> In what scenario would you prefer to propagate a default after reducing a<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> potential empty collection _without supplying an explicit default_ for that<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> operation? This would certainly violate the Swift convention of not<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> defaulting to zero and, I suspect, most users of Swift would not regard<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> that as ergonomic at all.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Fundamentally the default constructibles are useful in numerical<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> computations e..g. dealing with tensors.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> Can you give an example of an algorithm dealing with tensors where you<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> would use a `DefaultConstructible` generic over all types that have<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> `init()`, as opposed to working with the existing `Integer`,<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> `FloatingPoint`, and other numerical protocols? (I should also add, FWIW, I<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> have never seen a generic algorithm written for integers or FP types that<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> has preferred the use of `T()` over `0`.)<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> On Sun, Dec 25, 2016 at 3:30 PM, Xiaodi Wu <<a href="mailto:xiaodi.wu@gmail.com" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">xiaodi.wu@gmail.com</a>> wrote:<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></div></div><span class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg">>> On Sun, Dec 25, 2016 at 5:27 PM, Adam Nemecek <<a href="mailto:adamnemecek@gmail.com" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">adamnemecek@gmail.com</a>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> wrote:<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> > *Which* APIs become more ergonomic?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> I'll get back to this question in a second if I may. This would be a<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> longer discussion and I first want to make sure that before we get into the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> details that there is a possibility of this being introduced (I'm asking if<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> violating the no zero defaults is more important than slightly more<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> ergonomic APIs). But to give a broad answer I think that the concept of a<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> zero is closely related to the concept of equality (and all the things that<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> build up on equality such as comparability and negation).<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> > 1) How does this square with Swift’s general philosophy to not default<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> initialize values to “zero”?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> I actually wasn't aware of this philosophy. Despite this philosophy, look<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> at how many types actually currently implement a default constructor.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></span>>> (Not a rhetorical question:) Is it well settled, either in Swift or in<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><span class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg">>> C++/Rust/etc., that the value returned by a default initializer/constructor<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></span>>> is regarded as an identity element or zero? Is the thread that I get by<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><span class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374m_2766821119499066179m_-4530764108705073068im m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374m_2766821119499066179m_-4530764108705073068HOEnZb m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg">>> writing `let t = Thread()` some kind of zero in any reasonable sense of the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> word?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></span><span class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374m_2766821119499066179m_-4530764108705073068im m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374m_2766821119499066179m_-4530764108705073068HOEnZb m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg">>> Also can I ask what's the motivation behind this philosophy?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> I think that in Swift, default constructibility makes complete sense for<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> (most?) structs, maybe less so for classes.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> > 2) To your original example, it isn’t immediately clear to me that<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> reduce should choose a default identity. Some types (e.g. integers and FP)<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> belong to multiple different ring algebras, and therefore have different<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> identity values that correspond to the relevant binary operations.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> This is a good point that I've considered as well but felt that for the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> most part, there is one particular identity and associated operation that<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> is more prominent and useful than others. Furthermore, modeling different<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> algebras isn't mutually exclusive with writing generic algorithms that rely<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> on this protocol, you can always introduce some monoidic wrapper type that<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> defines the more appropriate default value and operation.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></span><span class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374m_2766821119499066179m_-4530764108705073068im m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374m_2766821119499066179m_-4530764108705073068HOEnZb m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg">>> Do you mean to argue that for an integer the additive identity should be<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> considered "more prominent and useful" than the multiplicative identity?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> I'm not aware of any mathematical justification for such a conclusion.<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></span><span class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374m_2766821119499066179m_-4530764108705073068im m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374m_2766821119499066179m_-4530764108705073068HOEnZb m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg">>> Going to your original example, I should add: other languages provide a<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> version of `reduce` that doesn't require an initial result (for instance,<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> JavaScript). In JavaScript, `[1, 2, 3].reduce((a, b) => a + b)` uses the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> element at array index 0 as the initial result, and the accumulator<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> function is invoked starting with the element at array index 1. This is<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> precisely equivalent to having `reduce` use the additive identity as the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> default initial result when + is the accumulator function and the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> multiplicative identity when * is the accumulator function (with the<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> accumulator function being invoked starting with the element at array index<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> 0). It does not require a DefaultConstructible protocol. What more<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>> ergonomic solution could be implemented using a monoidic wrapper type?<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">>><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></span><span class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374m_2766821119499066179m_-4530764108705073068im m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374m_2766821119499066179m_-4530764108705073068HOEnZb m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg">> ______________________________<wbr>_________________<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">> swift-evolution mailing list<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">> <a href="mailto:swift-evolution@swift.org" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></span><span class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374m_2766821119499066179m_-4530764108705073068HOEnZb m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><font color="#888888" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg">--<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">-Dave<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></font></span><div class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374m_2766821119499066179m_-4530764108705073068HOEnZb m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><div class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374m_2766821119499066179m_-4530764108705073068h5 m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">______________________________<wbr>_________________<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">swift-evolution mailing list<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><a href="mailto:swift-evolution@swift.org" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></div></div></blockquote></div><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"></div></div><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">______________________________<wbr>_________________<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">swift-evolution mailing list<br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><a href="mailto:swift-evolution@swift.org" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br class="m_-5169838607156867246m_-8879659397395202672m_-6624483711025557005m_2849072433074184374gmail_msg m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></blockquote></div></div><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></div></div><br class="m_-5169838607156867246gmail_msg">______________________________<wbr>_________________<br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg">swift-evolution mailing list<br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><a href="mailto:swift-evolution@swift.org" class="m_-5169838607156867246gmail_msg" target="_blank">swift-evolution@swift.org</a><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" class="m_-5169838607156867246gmail_msg" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"><br class="m_-5169838607156867246gmail_msg"></blockquote></div></div></div></blockquote></div></div></blockquote></div></div>
</div></div></blockquote></div><br></div></div>