> On 17 Jun 2015, at 13:33, Quincey Morris
> <[email protected]> wrote:
>
> On Jun 16, 2015, at 22:24 , Roland King <[email protected]
> <mailto:[email protected]>> wrote:
>>
>> 1) making FooImplementedWithArray internal downgrades the foo() function to
>> internal within that protocol, no longer is it public (this is made explicit
>> by a compiler warning which tells you you’re implementing an internal
>> function as public if you try doing it)
>> 2) anything implementing FooImplementedWithArray can at *most* be internal,
>> you can’t have a public class implement an internal protocol
>
> What about this:
>
>> public protocol Foo
>> {
>> mutating func foo( Int )->Void
>> }
>>
>> public protocol FooImplementedWithArray : Foo
>> {
>> }
>>
>> extension FooImplementedWithArray
>> {
>> var bar = Array<Int> ()
>> public mutating func foo( i : Int ) -> Void { bar.append( i ) }
>> }
>
> Then Foo’s that don’t use a bar array will provide their own implementation,
> and FooImplementedWithArray’s will default to the extension’s empty array, or
> they can override bar with some other implementation. At least, that’s what
> it looks like to me. :)
>
> Sorry if you said that already. In your explanation, I can’t seem to separate
> what you want from what you’ve tried.
>
No - can’t have a stored property in an extension
var bar = Array<Int>() // <— nope
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]