<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I agree mostly with what you’re saying, but variadic parameters don’t actually require at least one element. `max` simply returns a non-optional because its function signature has three non-variadic parameters as well:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">public</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">func</span><span style="font-variant-ligatures: no-common-ligatures" class=""> max<T : </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Comparable</span><span style="font-variant-ligatures: no-common-ligatures" class="">>(</span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">_</span><span style="font-variant-ligatures: no-common-ligatures" class=""> x: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">_</span><span style="font-variant-ligatures: no-common-ligatures" class=""> y: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">_</span><span style="font-variant-ligatures: no-common-ligatures" class=""> z: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">_</span><span style="font-variant-ligatures: no-common-ligatures" class=""> rest: </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">T</span><span style="font-variant-ligatures: no-common-ligatures" class="">...) -> </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">T</span></div></div><div class=""><br class=""></div>
> This has been brought up and there was a proposal by Haravikk, but the discussion started almost mid-July and the deadline for all Swift 3 *implementation* was on Jul 27. So it didn't make it, but I think there will be enough discussion about it on Aug 1 and after (all discussion about features for future Swift releases is currently on hold until Aug 1).<br class="">> <br class="">> Unfortunately, the suggested behavior has an issue what to do when the array is empty. For example, you've mentioned min and max - there are (as variadic) ensured to always be called with at least one value. When you use it with an array, there is no guarantee that the array contains any element. In such cases, what should the min/max do? Crash? Return +-infinity?<br class="">> <br class="">> Changing min/max to return an optional would be a solution, but I don't think a good one.<br class="">> <br class="">> Moreover, for this particular example, you already have min/max on arrays:<br class="">> <br class="">> let numbers = [23, 43, 12, 10]<br class="">> numbers.minElement()<br class="">> <br class="">> > On Jul 29, 2016, at 11:46 AM, Alexandre Lopoukhine via swift-evolution<<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>>wrote:<br class="">> > <br class="">> > Hello all,<br class="">> > <br class="">> > I'm not sure if this has been brought up before, or what the status of the issue is as of Swift 3, but I was wondering why there is no option to call a function that takes a variadic parameter argument with an array. Seen as the parameter essentially becomes an array, and is used as such in the function, I think that adding the ability to call it with one directly could be useful, with few downsides. This will, for example, allow you to use the built-in `min` and `max` functions on arrays.<br class="">> > <br class="">> > WDYT?<br class="">> > <br class="">> > – Sasha<br class="">> > _______________________________________________<br class="">> > swift-evolution mailing list<br class="">> > <a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">> > <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">> <br class="">> <br class="">><span class="Apple-converted-space"> </span>
</body></html>