[swift-evolution] User Defined Attributes/Annotations

Bryan Irace bryan at irace.me
Fri Dec 11 00:53:54 CST 2015


Really thrilled to hear that this is a priority. Custom annotation types (and a reflection API to consume them) were something I took advantage of constantly when writing Java and would very much love to see them in Swift.

> On Dec 10, 2015, at 9:09 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On Dec 9, 2015, at 9:40 PM, Akiva Leffert via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> Hi,
>> I’m interested in adding user defined annotations. For example,
>> 
>> 	```
>> 	@MyAnnotation func foo() {
>> 	}
>> 	```
>> 
>> This would help enable third party linting and behavioral documentation. This is useful in its own right, but it can also help inform the future direction of static checks within the language.
> 
> Quick feedback: I’d love to see Swift have this sort of functionality someday, but when it exists, it should almost certainly tie into the reflection system.  One of our stretch goals for Swift 3 is to rework the "mirror” APIs into a proper reflection system, and the design of user-defined annotations should wait until that settles out IMO.
> 
> -Chris
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution



More information about the swift-evolution mailing list