<div dir="ltr">When would you want to use this instead of something like `button[imageFor: .normal]` ?<div class="gmail_extra">
<br><div class="gmail_quote">On Mon, Jul 11, 2016 at 3:00 PM, Tim Vermeulen via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Slightly related to this, I would really love to have non-subscript parameterized properties. It would allow us to write<div><br></div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo"><span style="color:#4f8187">button</span><span>.image(</span><span style="color:#ba2da2">for</span><span>: .normal) = </span><span style="color:#4f8187">image</span></div></div><div><br></div><div>instead of</div><div><br></div><div><div style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(79,129,135)"><span>button</span><span style="color:#000000">.</span><span style="color:#3e1e81">setImage</span><span style="color:#000000">(</span><span>image</span><span style="color:#000000">, </span><span style="color:#ba2da2">for</span><span style="color:#000000">: .</span><span style="color:#703daa">normal</span><span style="color:#000000">)</span></div></div><div><br></div><div>The same can be achieved through subscripts, but it’s not always as nice. It would bring subscripts and computed properties closer together, which also seems to be the goal of your proposal. Perhaps the two ideas could be combined?<span class=""><br><div><br></div><div>&gt; Subscripts are a hybrid of properties and functions, since they have a parameter list, as well as getters and setters, so use of either symbol will be unusual in this case.<br>&gt; <br>&gt; However, I think a colon is more suitable, since it implies the possibility to set the value.<br>&gt; <br>&gt; <br>&gt; In the future, if we add throwing getters/ setters:<br>&gt; <br>&gt; subscript(_ position: Int) -&gt;Element {<br>&gt; get {<br>&gt; return …<br>&gt; }<br>&gt; throwing set {<br>&gt; …<br>&gt; }<br>&gt; }<br>&gt; <br>&gt; Should this require ‘throws -&gt;Element’? Using a colon also removes this potentially confusing case.<br>&gt; <br>&gt; <br>&gt; Thoughts?<br>&gt; <br>&gt; <br>&gt;<span> </span>

</div></span></div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div>