<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=""><blockquote type="cite" class="">On Jun 12, 2016, at 11:27 PM, Charlie Monroe via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></blockquote><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Jun 11, 2016, at 3:35 PM, Adrian Zubarev via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="bloop_markdown" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(254, 254, 254);"><p class="" style="margin: 15px 0px; -webkit-margin-before: 0px;">I just installed the current Swift 3 snapshot to play around with it (last from may crashed my Xcode all the time).</p><p class="" style="margin: 15px 0px;">I wanted to re-build a small project with (currently implemented) Swift 3 changes. Basically I had to look up on GitHub what the<span class="Apple-converted-space">&nbsp;</span><code class="" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;">default</code><span class="Apple-converted-space">&nbsp;</span>value for<span class="Apple-converted-space">&nbsp;</span><code class="" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal;">deinitialize(count:)</code><span class="Apple-converted-space">&nbsp;</span>function was for<span class="Apple-converted-space">&nbsp;</span><code class="" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal;">UnsafeMutablePointer</code>, just because Xcode and the docs can’t tell me that:</p><pre class="" style="margin: 15px 0px; font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 4px 8px; word-break: normal; word-wrap: normal;"><code class="swift" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 0px; margin: 0px; padding: 0px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;">/// De-initialize the `count` `Pointee`s starting at `self`, returning
/// their memory to an uninitialized state.
///
/// - Precondition: The `Pointee`s at `self..&lt;self + count` are
///   initialized.
///
/// - Postcondition: The memory is uninitialized.
public func deinitialize(count: Int = default)
</code></pre><p class="" style="margin: 15px 0px;">To cut it short:</p><ul class="" style="margin: 15px 0px;"><li class="" style="margin: 15px 0px; -webkit-margin-before: 0px;">Could we make<span class="Apple-converted-space">&nbsp;</span><code class="" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;">default</code><span class="Apple-converted-space">&nbsp;</span>function parameter values more transparent in Swift 3?</li><li class="" style="margin: 15px 0px;">Why are default parameter values translated to<span class="Apple-converted-space">&nbsp;</span><code class="" style="font-family: Menlo, Consolas, 'Liberation Mono', Courier, monospace; font-size: 10pt; border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; background-color: rgb(248, 248, 248); color: inherit; border: 1px solid rgb(234, 234, 234); margin: 0px 2px; padding: 0px 5px; word-break: normal; word-wrap: normal; -webkit-margin-before: 0px;">default</code><span class="Apple-converted-space">&nbsp;</span>rather than the actual value?</li></ul></div></div></blockquote><div class="">I guess that in some cases you don't want the default value to be known, or is irrelevant. Most importantly, it can be a more complex expression - e.g. creating an object and calling something on it:</div><div class=""><br class=""></div><div class="">private let mySecretNumber = 0x999</div><div class="">public func deinitialize(count: Int =&nbsp;NSProcessInfo().processorCount + mySecretNumber)</div><div class=""><br class=""></div><div class="">And that's a pretty example, it can get much nastier. Since mySecretNumber is private, it definitely cannot be exposed.</div></div></div></blockquote><br class=""></div>That was my reaction as well, but this change is already in the pipeline, according to Apple’s published plans.<div class=""><br class=""></div><div class=""><a href="https://github.com/apple/swift/blob/master/docs/LibraryEvolution.rst#default-argument-expressions" class="">https://github.com/apple/swift/blob/master/docs/LibraryEvolution.rst#default-argument-expressions</a></div><div class=""><br class=""></div><div class="">Presumably, once this goes through, it will no longer be possible to use a secret number as a default value.</div><div class=""><br class=""></div><div class="">Charles</div><div class=""><br class=""></div></body></html>