There is a lot of talk about stored properties in extensions. But do we really 
need them?

Instead I think we can introduce something like partial classes from C#. It is 
an often case our classes go hell of a big and we have to move some methods to 
dedicated extensions to increase readability. It is also an often case that 
those methods have some stored properties they work with. This is often leads 
to a pattern where we have all stored properties declared in Class.swift and 
then we implement extensions in Class+Something.swift files. 

I bet partial classes should only be available within one module, so you can’t 
extend class from library, etc and work close to text-wide level, just to ease 
the code navigation. That is also will allow some code generation tricks, 
making it easy to create UI/Level designers for Swift. (for example you can 
generate some methods and properties of a Scene class in an editor and mix-in 
that in the user’s project.)

Any thoughts?
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to