<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=""><br class=""><div><blockquote type="cite" class=""><div class="">Le 18 févr. 2016 à 08:29, Jacob Bandes-Storch via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Arguably, these are all framework/IDE-specific functionality, a.k.a. "custom attributes", which should have an entirely different syntax.</div></div></blockquote><div><br class=""></div>+1</div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra">
<br class=""><div class="gmail_quote">On Wed, Feb 17, 2016 at 9:43 PM, Erica Sadun via swift-evolution <span dir="ltr" class="">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">How would you re-design the existing upper camel attributes then?<br class="">
<br class="">
They are: @UIApplicationMain, @NSManaged, @NSCopying, @NSApplicationMain, @IBAction, @IBDesignable, @IBInspectable, and @IBOutlet<br class="">
<span class="HOEnZb"><font color="#888888" class=""><br class="">
-- E<br class="">
</font></span><div class="HOEnZb"><div class="h5"><br class="">
<br class="">
&gt; On Feb 17, 2016, at 10:29 PM, Brent Royal-Gordon &lt;<a href="mailto:brent@architechies.com" class="">brent@architechies.com</a>&gt; wrote:<br class="">
&gt;<br class="">
&gt;&gt; @Autoclosure // was @autoclosure<br class="">
&gt;&gt; @Available // was @available<br class="">
&gt;&gt; @ObjC // was @objc<br class="">
&gt;&gt; @NoEscape // was @noescape<br class="">
&gt;&gt; @NonObjC // was @nonobjc<br class="">
&gt;&gt; @NoReturn // was @noreturn<br class="">
&gt;&gt; @Testable // was @testable<br class="">
&gt;&gt; @WarnUnusedResult // was @warn-unused-result<br class="">
&gt;&gt; @Convention&nbsp; // was @convention<br class="">
&gt;&gt; @NoReturn // was @noreturn<br class="">
&gt;&gt;<br class="">
&gt;&gt; In the revised design, the following example for Swift 2.2<br class="">
&gt;&gt;<br class="">
&gt;&gt; @warn_unused_result(mutable_variant="sortInPlace")<br class="">
&gt;&gt; public func sort() -&gt; [Self.Generator.Element]<br class="">
&gt;&gt;<br class="">
&gt;&gt; becomes<br class="">
&gt;&gt;<br class="">
&gt;&gt; @WarnUnusedResult(mutableVariant: "sortInPlace")<br class="">
&gt;&gt; public func sort() -&gt; [Self.Generator.Element]<br class="">
&gt;<br class="">
&gt; Wow, I'm surprised by how much I hate this. Currently, all Swift keywords are entirely lowercase (ignoring things like `Type`, `Protocol`, and `dynamicType` which come after a dot). I think I've learned to half-ignore things that look like that, but capitalizing suddenly pulls the spotlight onto these keywords. I'm just not a fan.<br class="">
&gt;<br class="">
&gt; I think we're better off renaming or redesigning `warn_unused_result` so that it's readable when it's all-lowercase with no underscores. Some ideas:<br class="">
&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp;@onlyreturns func sorted() -&gt; [Self.Generator.Element]<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp;func sorted() -&gt; @important [Self.Generator.Element]<br class="">
&gt;<br class="">
&gt; Alternatively, we could reverse the semantic and make all all non-Void functions warn unless they have an attribute saying not to.<br class="">
&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp;@ignoreresult mutating func updateValue(value: Value, forKey key: Key) -&gt; Value?<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp;mutating func updateValue(value: Value, forKey key: Key) -&gt; @ignorable Value?<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp;mutating func updateValue(value: Value, forKey key: Key) -&gt; @convenience Value?<br class="">
&gt;<br class="">
&gt; If we do that, we'll likely still want to be able to annotate non-mutating methods with their mutating variants (well, unless we think the compiler can guess based on the API Guidelines.)<br class="">
&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp;@variant(mutating: "sort") func sorted() -&gt; [Self.Generator.Element]<br class="">
&gt;&nbsp; &nbsp; &nbsp; &nbsp;@alternative(mutating: "sort") func sorted() -&gt; [Self.Generator.Element]<br class="">
&gt;<br class="">
&gt; That opens the possibility of using `@variant(nonmutating:)` on mutating functions, too.<br class="">
&gt;<br class="">
&gt; --<br class="">
&gt; Brent Royal-Gordon<br class="">
&gt; Architechies<br class="">
&gt;<br class="">
<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" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</div></div></blockquote></div><br class=""></div></div>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>