Abstract methods

to me protocol extensions are both cool and evil. cool as you can add code.
evil because it's more natural to add another declarations in those
extensions rather than implementation:

protocol Foo {
    func foo()
}

extension Foo {
   func bar() //*** natural assumption is that i can do this. but i can't
}

i'd say, abusing "extension protocol" syntax to add code looks like a
(cool) hack and my +1 would be for some other more explicit syntactic
construct for the purposes of adding code, for example:

implementation Foo {
    func foo() {
        ...
    }
}

Mike

···

on Sun, 5 Nov 2017 09:27:09 +0000 Goffredo Marocchi <panajev@gmail.com> wrote:

I would say that you kind of already entered a slippery slope when the
extension to a protocol can add code / not just declare a behavioural
contract ...

to me protocol extensions are both cool and evil. cool as you can add code. evil because it's more natural to add another declarations in those extensions rather than implementation:

protocol Foo {
    func foo()
}

extension Foo {
   func bar() //*** natural assumption is that i can do this. but i can't
}

After a moment of reflection, I think I understand your reasoning — but why should you want to do this?
Imho splitting types with extensions is already overused quite often, but splitting a protocol makes no sense for me at all.

the use case would be splitting my own big protocols into different parts
for code organizing purposes (so it's within the module boundaries).

Mike

···

On 6 November 2017 at 19:44, Tino Heth <2th@gmx.de> wrote:

to me protocol extensions are both cool and evil. cool as you can add
code. evil because it's more natural to add another declarations in those
extensions rather than implementation:

protocol Foo {
    func foo()
}

extension Foo {
   func bar() //*** natural assumption is that i can do this. but i
can't
}

After a moment of reflection, I think I understand your reasoning — but
why should you want to do this?
Imho splitting types with extensions is already overused quite often, but
splitting a protocol makes no sense for me at all.