[swift-evolution] Proposal - Allow properties in Extensions
Chris Lattner
clattner at apple.com
Fri Dec 18 22:11:35 CST 2015
On Dec 18, 2015, at 4:11 PM, John McCall via swift-evolution <swift-evolution at swift.org> wrote:
>>
>> One potentially large downside is you can no longer look at a type declaration and find out how large it is. For example, I could define
>>
>> struct Foo {
>> var x: Int
>> }
>>
>> and it looks like a tiny struct, but I could then add an extension in a separate file that bloats that out to some ridiculously massive struct, and that wouldn't be obvious from looking at it.
>
> I think any storage-in-extensions proposal ought to be a special feature of classes; I would not support the ability to add stored properties to structs in extensions, even from within the module.
I agree.
-Chris
More information about the swift-evolution
mailing list