<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="">They are quite related considering a subscript can have a getter-setter pair. &nbsp;Brent already has a proposal to cover throwing properties (and subscripts), so we’re overlapping in that regard.&nbsp;</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 20, 2016, at 1:33 PM, David Rönnqvist &lt;<a href="mailto:david.ronnqvist@gmail.com" class="">david.ronnqvist@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class="">Would this proposal in any way be related to `throw`ing properties (more specifically throwing setters)? Or would that be a completely different discussion/proposal?</div><div class=""><br class=""></div><div class="">- David</div><div class=""><br class="">On 20 Jun 2016, at 21:27, Matthew Johnson via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div class=""><br class=""><br class="">Sent from my iPhone</div><div class=""><br class="">On Jun 20, 2016, at 1:10 PM, Robert Widmann via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class="">Good morning all. &nbsp;Attached is the proposal Harlan Haskins and I will be submitting shortly about adding generic and `throw`ing subscript declarations to the language.&nbsp;</div></blockquote><div class=""><br class=""></div><div class="">+1. &nbsp;Thank you for bringing forward this proposal. &nbsp;I ran into these limitations in exactly the context you mention in the proposal.</div><div class=""><br class=""></div><div class="">Another context where this will be useful is emulating higher-rank "callable" types (using subscript for function invocation).</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class=""></div><div class="">Cheers,</div><div class=""><br class=""></div><div class="">~Robert Widmann<br class=""><div class=""><br class=""></div><div class=""><h1 class="" style="box-sizing: border-box; font-size: 2.25em; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 1.2; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; margin-top: 0px !important;">Generic and Throwing Subscripts</h1><ul class="" style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px;"><li class="" style="box-sizing: border-box;">Proposal:&nbsp;<a href="https://github.com/apple/swift-evolution/blob/master/proposals/NNNN-name.md" class="" style="box-sizing: border-box; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;">SE-NNNN</a></li><li class="" style="box-sizing: border-box;">Author(s):&nbsp;<a href="https://github.com/harlanhaskins" class="" style="box-sizing: border-box; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;">Harlan Haskins</a>&nbsp;and&nbsp;<a href="https://github.com/codafi" class="" style="box-sizing: border-box; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;">Robert Widmann</a></li><li class="" style="box-sizing: border-box;">Status:&nbsp;<span class="" style="box-sizing: border-box;"><a href="https://github.com/typelift/SwiftCheck/pull/168#rationale" class="" style="box-sizing: border-box; -webkit-text-decoration-skip: objects; color: rgb(64, 120, 192); text-decoration: none;">Awaiting review</a></span></li><li class="" style="box-sizing: border-box;">Review manager: TBD</li></ul><h2 class="" style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.225; font-size: 1.75em; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';">Introduction</h2><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px;">Currently, subscripts cannot be declared&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 11.899999618530273px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">[re]throws</code>&nbsp;and cannot declare new generic parameters.<br class="" style="box-sizing: border-box;">There isn't a clear reason why they aren't as capable as full-fledged functions, so we propose<br class="" style="box-sizing: border-box;">adding generic constraints and throwing semantics to subscripts.</p><h2 class="" style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.225; font-size: 1.75em; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';">Motivation</h2><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px;">On the throwing side, currently there are two ways to express a failing subscript:</p><ul class="" style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px;"><li class="" style="box-sizing: border-box;">Return an&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 11.899999618530273px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">Optional</code>, failing with&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 11.899999618530273px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">nil</code>.</li><li class="" style="box-sizing: border-box;">Call&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 11.899999618530273px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">fatalError(_:)</code>&nbsp;on failure.</li></ul><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px;">Both of these throw out useful information about the cause of the underlying error that using Swift's error handling mechanism can otherwise provide.</p><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px;">As for generics, to take an example, it has become a common pattern among JSON decoding DSL libraries to express a throwing generic extension on&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 11.899999618530273px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">Dictionary</code>&nbsp;like so</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; overflow: visible !important;"><pre class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 11.899999618530273px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;"><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">extension</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Dictionary</span> {
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">func</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(121, 93, 163);">parse</span>&lt;T&gt;(key: Key) throws <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> T {
        <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">guard</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> value <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">self</span>[key] <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">else</span> {
            <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">throw</span> JSONError<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>MissingKey(<span class="pl-s" style="box-sizing: border-box; color: rgb(24, 54, 145);"><span class="pl-pds" style="box-sizing: border-box;">"</span><span class="pl-pse" style="box-sizing: border-box;">\(</span><span class="pl-s1" style="box-sizing: border-box; color: rgb(51, 51, 51);">key</span><span class="pl-pse" style="box-sizing: border-box;">)</span><span class="pl-pds" style="box-sizing: border-box;">"</span></span>)
        }
        <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">guard</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> ofType <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> value <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">as?</span> T <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">else</span> {
            <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">throw</span> JSONError<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>InvalidKey(key: <span class="pl-s" style="box-sizing: border-box; color: rgb(24, 54, 145);"><span class="pl-pds" style="box-sizing: border-box;">"</span><span class="pl-pse" style="box-sizing: border-box;">\(</span><span class="pl-s1" style="box-sizing: border-box; color: rgb(51, 51, 51);">key</span><span class="pl-pse" style="box-sizing: border-box;">)</span><span class="pl-pds" style="box-sizing: border-box;">"</span></span>, expectedType: T<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">self</span>, foundType: value<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">dynamicType</span>)
        }
        <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">return</span> ofType
    }
}

<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">enum</span> JSONError: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">ErrorType</span>, <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">CustomStringConvertible</span> {
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">case</span> InvalidKey(key: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">String</span>, expectedType: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Any</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">Type</span>, foundType: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Any</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">Type</span>)
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">case</span> MissingKey(<span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">String</span>)
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">var</span> description: <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">String</span> {
        <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">switch</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">self</span> {
        <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">case</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>InvalidKey(<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> key, <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> expected, <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> found):
            <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">return</span> <span class="pl-s" style="box-sizing: border-box; color: rgb(24, 54, 145);"><span class="pl-pds" style="box-sizing: border-box;">"</span>Invalid key <span class="pl-cce" style="box-sizing: border-box;">\"</span><span class="pl-pse" style="box-sizing: border-box;">\(</span><span class="pl-s1" style="box-sizing: border-box; color: rgb(51, 51, 51);">key</span><span class="pl-pse" style="box-sizing: border-box;">)</span><span class="pl-cce" style="box-sizing: border-box;">\"</span>. Expected value of type <span class="pl-cce" style="box-sizing: border-box;">\"</span><span class="pl-pse" style="box-sizing: border-box;">\(</span><span class="pl-s1" style="box-sizing: border-box; color: rgb(51, 51, 51);">expected</span><span class="pl-pse" style="box-sizing: border-box;">)</span><span class="pl-cce" style="box-sizing: border-box;">\"</span>, found <span class="pl-cce" style="box-sizing: border-box;">\"</span><span class="pl-pse" style="box-sizing: border-box;">\(</span><span class="pl-s1" style="box-sizing: border-box; color: rgb(51, 51, 51);">found</span><span class="pl-pse" style="box-sizing: border-box;">)</span><span class="pl-cce" style="box-sizing: border-box;">\"</span>.<span class="pl-pds" style="box-sizing: border-box;">"</span></span>
        <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">case</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>MissingKey(<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> key):
            <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">return</span> <span class="pl-s" style="box-sizing: border-box; color: rgb(24, 54, 145);"><span class="pl-pds" style="box-sizing: border-box;">"</span>Key <span class="pl-pse" style="box-sizing: border-box;">\(</span><span class="pl-s1" style="box-sizing: border-box; color: rgb(51, 51, 51);">key</span><span class="pl-pse" style="box-sizing: border-box;">)</span> not found.<span class="pl-pds" style="box-sizing: border-box;">"</span></span>
        }
    }
}</pre></div><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px;">Given this, one can decode JSON with the full support of native type inference and exception handling. But when working with the DSL, one would expect to be able to express this as a subscript on&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 11.899999618530273px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">Dictionary</code>, allowing the following:</p><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; overflow: visible !important;"><pre class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 11.899999618530273px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;"><span class="pl-c" style="box-sizing: border-box; color: rgb(150, 152, 150);">//...</span>

<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">extension</span> <span class="pl-c1" style="box-sizing: border-box; color: rgb(0, 134, 179);">Dictionary</span> {
    <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">public</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">subscript</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">&lt;</span>T<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">&gt;</span>(key: Key) <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">throws</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">-&gt;</span> T {
        <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">guard</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> value <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">self</span>[key] <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">else</span> {
            <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">throw</span> JSONError<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>MissingKey(<span class="pl-s" style="box-sizing: border-box; color: rgb(24, 54, 145);"><span class="pl-pds" style="box-sizing: border-box;">"</span><span class="pl-pse" style="box-sizing: border-box;">\(</span><span class="pl-s1" style="box-sizing: border-box; color: rgb(51, 51, 51);">key</span><span class="pl-pse" style="box-sizing: border-box;">)</span><span class="pl-pds" style="box-sizing: border-box;">"</span></span>)
        }
        <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">guard</span> <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">let</span> ofType <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">=</span> value <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">as?</span> T <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">else</span> {
            <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">throw</span> JSONError<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span>InvalidKey(key: <span class="pl-s" style="box-sizing: border-box; color: rgb(24, 54, 145);"><span class="pl-pds" style="box-sizing: border-box;">"</span><span class="pl-pse" style="box-sizing: border-box;">\(</span><span class="pl-s1" style="box-sizing: border-box; color: rgb(51, 51, 51);">key</span><span class="pl-pse" style="box-sizing: border-box;">)</span><span class="pl-pds" style="box-sizing: border-box;">"</span></span>, expectedType: T<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">self</span>, foundType: value<span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">.</span><span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">dynamicType</span>)
        }
        <span class="pl-k" style="box-sizing: border-box; color: rgb(167, 29, 93);">return</span> ofType
    }
}</pre></div><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px;">We believe this is an even more natural way to write these kinds of libraries in Swift and that bringing subscript member declarations up to par with functions is a useful addition to the language as a whole.</p><h2 class="" style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.225; font-size: 1.75em; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';">Proposed solution</h2><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px;">Add the ability to introduce new generic parameters and mark&nbsp;<code class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 11.899999618530273px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.0392157); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;">throws</code>&nbsp;and <span style="font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 11.899999618530273px; background-color: rgba(0, 0, 0, 0.0392157);" class="">rethrows&nbsp;</span>on subscript members.</p><h2 class="" style="box-sizing: border-box; margin-top: 1em; margin-bottom: 16px; line-height: 1.225; font-size: 1.75em; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';">Detailed design</h2><p class="" style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px;">This change will modify and add the following productions in the Swift grammar</p><div class="highlight highlight-source-diff" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; overflow: visible !important;"><pre class="" style="box-sizing: border-box; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 11.899999618530273px; margin-top: 0px; margin-bottom: 0px; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;">GRAMMAR OF A SUBSCRIPT DECLARATION

subscript-declaration → subscript-head subscript-result code-block
subscript-declaration → subscript-head subscript-result getter-setter-block
subscript-declaration → subscript-head subscript-result getter-setter-keyword-block
<span class="pl-md" style="box-sizing: border-box; background-color: rgb(255, 236, 236); color: rgb(189, 44, 0);">-subscript-head → attributes(opt) declaration-modifiers(opt) subscript parameter-clause</span>
<span class="pl-mi1" style="box-sizing: border-box; background-color: rgb(234, 255, 234); color: rgb(85, 165, 50);">+subscript-head → attributes(opt) declaration-modifiers(opt) generic-parameter-clause(opt) subscript parameter-clause</span>
<span class="pl-mi1" style="box-sizing: border-box; background-color: rgb(234, 255, 234); color: rgb(85, 165, 50);">+subscript-result → -&gt; attributes(opt) throws(opt) type</span>
<span class="pl-mi1" style="box-sizing: border-box; background-color: rgb(234, 255, 234); color: rgb(85, 165, 50);">+subscript-result → -&gt; attributes(opt) rethrows(opt) type</span></pre></div><hr class="" style="box-sizing: content-box; height: 4px; overflow: hidden; margin: 16px 0px; background-color: rgb(231, 231, 231); border: 0px none; padding: 0px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px;"><h1 class="" style="box-sizing: border-box; font-size: 2.25em; margin: 1em 0px 16px; line-height: 1.2; padding-bottom: 0.3em; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(238, 238, 238); color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';">Rationale</h1><div class="" style="box-sizing: border-box; margin-top: 0px; color: rgb(51, 51, 51); font-family: 'Helvetica Neue', Helvetica, 'Segoe UI', Arial, freesans, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 14px; margin-bottom: 0px !important;">On [Date], the core team decided to&nbsp;<span class="" style="box-sizing: border-box;">(TBD)</span>&nbsp;this proposal.<br class="" style="box-sizing: border-box;">When the core team makes a decision regarding this proposal,<br class="" style="box-sizing: border-box;">their rationale for the decision will be written here.</div></div></div></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div></div></blockquote></div><br class=""></body></html>