<div dir="ltr">+1, seems right to me. The original email wasn't clear to me, but this example is.<div><br></div><div>FWIW, as a user of the language I'd hope that throwing subscript getters/setters would be written "set throws { ... }" and/or "set(newValue) throws { ... }" rather than "throwing set { ... }", for consistency with function bodies.</div><div class="gmail_extra"><br></div><div class="gmail_extra">...and now that I'm thinking about it, I'm almost tempted to recommend "subscript[_ example: Int]: Element". Is that too crazy?</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Jacob<br></div></div></div></div>
<br><div class="gmail_quote">On Sun, Jul 10, 2016 at 4:18 PM, James Froggatt via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Currently, the signature is:<br>
subscript(_ example: Int) -> Element {<br>
get { … }<br>
set { … }<br>
}<br>
<br>
The alternative, using a colon, would be:<br>
subscript(_ example: Int) : Element {<br>
get { … }<br>
set { … }<br>
}<br>
<br>
Sorry if that wasn't clear.<br>
<br>
This would be to better reflect the property-like nature of access.<br>
<br>
>From James F<br>
<div class="HOEnZb"><div class="h5"><br>
On 10 Jul 2016, at 23:57, Brent Royal-Gordon <<a href="mailto:brent@architechies.com">brent@architechies.com</a>> wrote:<br>
<br>
>> On Jul 9, 2016, at 11:48 AM, James Froggatt via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
>><br>
>> 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>
>><br>
>> However, I think a colon is more suitable, since it implies the possibility to set the value.<br>
><br>
> Can you show us an example of the current syntax and your proposed replacement? I'm not sure what you actually mean by "use colons".<br>
><br>
> --<br>
> Brent Royal-Gordon<br>
> Architechies<br>
><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>
</div></div></blockquote></div><br></div></div>