[swift-evolution] Proposal - Allow properties in Extensions

Chris Lattner clattner at apple.com
Tue Dec 8 23:21:24 CST 2015


> On Dec 8, 2015, at 10:51 AM, Kevin Kachikian via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I’d like to proposal to the Swift community and discuss the advantages and disadvantages of adding modifiable properties to extensions (in addition to the already existing computed properties, instance methods, subscripts, etc.):
> 
> extension SomeType {
> 	
> 	var aNewProperty: Int
> 	var anotherVariable: String
> 	var aThirdOne: MyStruct

IMO, this is a generally desirable thing.  It would be great to replace the need to use objc_setAssociatedObject with proper language support.  That said, the exact semantics and implementation details are unclear, so we’d need a specific detailed proposal.

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151208/8d65c38f/attachment.html>


More information about the swift-evolution mailing list