Huge +1 in general, but with one exception: > On Mar 30, 2017, at 12:07 PM, Ross O'Brien via swift-evolution > <[email protected]> wrote: > > struct Foo > { > conformance Bar // or conformance Foo : Bar, but since the region is inside > Foo that's redundant > { > var integer : Int // visible because Foo : Bar, at Bar's access level > > var counter : Int = 0 // only visible inside the conformance scope, > because not declared in Bar > > func increment() // visible because Foo : Bar, at Bar's access level > { > counter += 1 > } > } > }
Making ‘counter’ private here without being annotated as such is just going to cause confusion. If a member is to be private to the conformance, it should have the ‘private’ keyword in front of it to make that clear. If we want to enforce that the only non-private members in the conformance should be members that actually go toward implementing the conformance, then we should just have the above generate a compiler error, with the fix-it being to add ‘private’ to the declaration. Massive +1 otherwise. Charles
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
