[Pitch] separate syntax of class inheritance and protocol conformance


(Vladimir) #1

I remember that this was discussed, but can't find any decision regarding this.. So, as a last chance, don't we want in Swift 3.0, as big source breaking change, separate class inheritance and protocol conformance in syntax?

Sorry if there was a decision about this suggestions. Please let know in this case.

I.e. when I see the following I can't understand if the class inherits from base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other suffix/prefix, or classes with 'T'/'C' prefix or something like this, so I believe to improve the clarity of code we should separate in syntax inheritance and conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

Thoughts?


(Daniel Duan) #2

The current syntax establishes a relationship.

  X: Y

means "X will have interface of Y". Note there's no mention of inheritance or protocol here: they both establish this relationship. This is why we can use

  z is Y

To check whether such relationship holds. Again, there's no need to worry whether Y is a class or protocol.

That being said, I agree that user have to look up Y's declaration to determine which one they are writing/reading. But is that a real issue? Why would you write/use "class X: Y {}" before knowing what Y is?

Daniel Duan

···

Sent from my iPhone

On Jul 22, 2016, at 6:14 AM, Vladimir.S via swift-evolution <swift-evolution@swift.org> wrote:

I remember that this was discussed, but can't find any decision regarding this.. So, as a last chance, don't we want in Swift 3.0, as big source breaking change, separate class inheritance and protocol conformance in syntax?

Sorry if there was a decision about this suggestions. Please let know in this case.

I.e. when I see the following I can't understand if the class inherits from base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other suffix/prefix, or classes with 'T'/'C' prefix or something like this, so I believe to improve the clarity of code we should separate in syntax inheritance and conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

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


(Brandon Knope) #3

Honest question: what is actually confusing about the current behavior?

I.E. What is important about knowing whether "DataSource" is a class or a protocol?

I thought the blurred distinction was intentional?

Brandon

···

On Jul 22, 2016, at 9:47 AM, Charlie Monroe via swift-evolution <swift-evolution@swift.org> wrote:

I agree that this is an issue. Mostly nowadays when more and more classes in Swift do not have a superclass - it simply looks weird:

class MyClass: DataSource

One doesn't know whether "DataSource" is a class, protocol, etc. Nevertheless, I do not feel that :: is the answer. I really liked, how ObjC did it (which isn't possible with the generics now - is it?), but what about something like this?

class BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
class MyClass: BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
extension MyClass [OtherProtocol]

On Jul 22, 2016, at 3:14 PM, Vladimir.S via swift-evolution <swift-evolution@swift.org> wrote:

I remember that this was discussed, but can't find any decision regarding this.. So, as a last chance, don't we want in Swift 3.0, as big source breaking change, separate class inheritance and protocol conformance in syntax?

Sorry if there was a decision about this suggestions. Please let know in this case.

I.e. when I see the following I can't understand if the class inherits from base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other suffix/prefix, or classes with 'T'/'C' prefix or something like this, so I believe to improve the clarity of code we should separate in syntax inheritance and conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

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

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


(Brandon Knope) #4

I understand.

But why would you need to know if it's a class or a protocol to use the type? What understanding comes from knowing this information?

I am honestly trying to understand the problem here and it feels like I'm overlooking something.

Brandon

···

On Jul 22, 2016, at 10:12 AM, Charlie Monroe <charlie@charliemonroe.net> wrote:

Coming to someone elses code, it adds an extra effort to understand the declaration. Putting inheritance and conformance separately makes the declaration easier to read. At least for me.

On Jul 22, 2016, at 4:05 PM, Brandon Knope <bknope@me.com> wrote:

Honest question: what is actually confusing about the current behavior?

I.E. What is important about knowing whether "DataSource" is a class or a protocol?

I thought the blurred distinction was intentional?

Brandon

On Jul 22, 2016, at 9:47 AM, Charlie Monroe via swift-evolution <swift-evolution@swift.org> wrote:

I agree that this is an issue. Mostly nowadays when more and more classes in Swift do not have a superclass - it simply looks weird:

class MyClass: DataSource

One doesn't know whether "DataSource" is a class, protocol, etc. Nevertheless, I do not feel that :: is the answer. I really liked, how ObjC did it (which isn't possible with the generics now - is it?), but what about something like this?

class BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
class MyClass: BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
extension MyClass [OtherProtocol]

On Jul 22, 2016, at 3:14 PM, Vladimir.S via swift-evolution <swift-evolution@swift.org> wrote:

I remember that this was discussed, but can't find any decision regarding this.. So, as a last chance, don't we want in Swift 3.0, as big source breaking change, separate class inheritance and protocol conformance in syntax?

Sorry if there was a decision about this suggestions. Please let know in this case.

I.e. when I see the following I can't understand if the class inherits from base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other suffix/prefix, or classes with 'T'/'C' prefix or something like this, so I believe to improve the clarity of code we should separate in syntax inheritance and conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

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

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


(Ross O'Brien) #5

I think we're making incremental progress here. The idea of declaring a
property which inherited from a given class and conformed to given
protocols has definitely been discussed, but hasn't been reviewed (I don't
know offhand whether it's scheduled or even formally written up). The idea
of writing this for the declaration of the type itself might be new, I'm
not sure.

I think SE-0095 - declaring multiple protocol conformances with '&' - was
part of that progression, which might address some of your pitch, e.g. this
example could be a bit clearer:
class Child: BaseClass, SomeProtocol1, SomeProtocol2
would now be
class Child: BaseClass, SomeProtocol1 & SomeProtocol2

Is some of this waiting on a fully thought out syntax for types including
existentials?

···

On Fri, Jul 22, 2016 at 2:14 PM, Vladimir.S via swift-evolution < swift-evolution@swift.org> wrote:

I remember that this was discussed, but can't find any decision regarding
this.. So, as a last chance, don't we want in Swift 3.0, as big source
breaking change, separate class inheritance and protocol conformance in
syntax?

Sorry if there was a decision about this suggestions. Please let know in
this case.

I.e. when I see the following I can't understand if the class inherits
from base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other
suffix/prefix, or classes with 'T'/'C' prefix or something like this, so I
believe to improve the clarity of code we should separate in syntax
inheritance and conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and
conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

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


(Ian Partridge) #6

Now that SE-0095 is accepted, I think it would be a good idea to use
the infix & operator for specifying protocol conformance as well.

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1 & SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1 & SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1 & SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1 & BaseProtocol2

Thanks,
Ian

···

On 22 July 2016 at 14:14, Vladimir.S via swift-evolution <swift-evolution@swift.org> wrote:

I remember that this was discussed, but can't find any decision regarding
this.. So, as a last chance, don't we want in Swift 3.0, as big source
breaking change, separate class inheritance and protocol conformance in
syntax?

Sorry if there was a decision about this suggestions. Please let know in
this case.

I.e. when I see the following I can't understand if the class inherits from
base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other suffix/prefix,
or classes with 'T'/'C' prefix or something like this, so I believe to
improve the clarity of code we should separate in syntax inheritance and
conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and
conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

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

--
Ian Partridge


(Charlie Monroe) #7

I agree that this is an issue. Mostly nowadays when more and more classes in Swift do not have a superclass - it simply looks weird:

class MyClass: DataSource

One doesn't know whether "DataSource" is a class, protocol, etc. Nevertheless, I do not feel that :: is the answer. I really liked, how ObjC did it (which isn't possible with the generics now - is it?), but what about something like this?

class BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
class MyClass: BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
extension MyClass [OtherProtocol]

···

On Jul 22, 2016, at 3:14 PM, Vladimir.S via swift-evolution <swift-evolution@swift.org> wrote:

I remember that this was discussed, but can't find any decision regarding this.. So, as a last chance, don't we want in Swift 3.0, as big source breaking change, separate class inheritance and protocol conformance in syntax?

Sorry if there was a decision about this suggestions. Please let know in this case.

I.e. when I see the following I can't understand if the class inherits from base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other suffix/prefix, or classes with 'T'/'C' prefix or something like this, so I believe to improve the clarity of code we should separate in syntax inheritance and conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

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


(Charlie Monroe) #8

Coming to someone elses code, it adds an extra effort to understand the declaration. Putting inheritance and conformance separately makes the declaration easier to read. At least for me.

···

On Jul 22, 2016, at 4:05 PM, Brandon Knope <bknope@me.com> wrote:

Honest question: what is actually confusing about the current behavior?

I.E. What is important about knowing whether "DataSource" is a class or a protocol?

I thought the blurred distinction was intentional?

Brandon

On Jul 22, 2016, at 9:47 AM, Charlie Monroe via swift-evolution <swift-evolution@swift.org> wrote:

I agree that this is an issue. Mostly nowadays when more and more classes in Swift do not have a superclass - it simply looks weird:

class MyClass: DataSource

One doesn't know whether "DataSource" is a class, protocol, etc. Nevertheless, I do not feel that :: is the answer. I really liked, how ObjC did it (which isn't possible with the generics now - is it?), but what about something like this?

class BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
class MyClass: BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
extension MyClass [OtherProtocol]

On Jul 22, 2016, at 3:14 PM, Vladimir.S via swift-evolution <swift-evolution@swift.org> wrote:

I remember that this was discussed, but can't find any decision regarding this.. So, as a last chance, don't we want in Swift 3.0, as big source breaking change, separate class inheritance and protocol conformance in syntax?

Sorry if there was a decision about this suggestions. Please let know in this case.

I.e. when I see the following I can't understand if the class inherits from base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other suffix/prefix, or classes with 'T'/'C' prefix or something like this, so I believe to improve the clarity of code we should separate in syntax inheritance and conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

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

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


(Tino) #9

I have the feeling that there's to much stress right now to handle this pitch in the way it deserves… it might be better to do the split, but imho there is no obvious syntax for protocol conformance, so I expect a long discussion on the details.

Depending on how important protocols will become in the future, it could be really nice to have a separate namespace for them:
It would remove the need for a "protocol-suffix" (…Type), and it could even be feasible to automatically derive protocols from the interface of classes…
I'm not sure how useful this would be, but it would be much less work to build libraries that utilizes the flexibility of protocols.

Example:
You could create a algebra-library with a standard matrix-struct, but write the majority of the functions for a derived matrix-protocol, so that users can easily write their own implementations with custom memory-layout.
This would be especially useful as structs don't support inheritance right now, so if I want to create a SparseMatrix-struct, it is not possible to utilize all the hypothetical SimpleMatrix-methods (unless I create a protocol manually).


(Vladimir) #10

Yes, this could be a solution, but what about just one protocol conformance?

class Child: SomeProtocol
class Child: BaseClass

IMO we still need to separate the definition

.. or

class Child: &SomeProtocol

but I don't believe such could be accepted/allowed.

And, after all, this still changes the syntaxt, so we need to decide if this change should be done in Swift 3.0, or after, or never..

···

On 22.07.2016 16:41, Ian Partridge wrote:

Now that SE-0095 is accepted, I think it would be a good idea to use
the infix & operator for specifying protocol conformance as well.

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1 & SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1 & SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1 & SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1 & BaseProtocol2

Thanks,
Ian

On 22 July 2016 at 14:14, Vladimir.S via swift-evolution > <swift-evolution@swift.org> wrote:

I remember that this was discussed, but can't find any decision regarding
this.. So, as a last chance, don't we want in Swift 3.0, as big source
breaking change, separate class inheritance and protocol conformance in
syntax?

Sorry if there was a decision about this suggestions. Please let know in
this case.

I.e. when I see the following I can't understand if the class inherits from
base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other suffix/prefix,
or classes with 'T'/'C' prefix or something like this, so I believe to
improve the clarity of code we should separate in syntax inheritance and
conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and
conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

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


(Karl) #11

What about if we defined subclasses with the “subclass” keyword instead of “class”? So you knew the first parameter was always going to be a base class?

That way we keep the single “:” everywhere else - where clauses, generic constraints lists, etc.

···

On 22 Jul 2016, at 15:14, Vladimir.S via swift-evolution <swift-evolution@swift.org> wrote:

I remember that this was discussed, but can't find any decision regarding this.. So, as a last chance, don't we want in Swift 3.0, as big source breaking change, separate class inheritance and protocol conformance in syntax?

Sorry if there was a decision about this suggestions. Please let know in this case.

I.e. when I see the following I can't understand if the class inherits from base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other suffix/prefix, or classes with 'T'/'C' prefix or something like this, so I believe to improve the clarity of code we should separate in syntax inheritance and conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

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


(Vladimir) #12

I don't understand the question, really. I need to know because I need to know :slight_smile:
I.e. I see new code, I'm trying to understand the structure of the class, its dependency, if all the base code of this class is inside this class or there is some 'base' code that is overriden, etc.. Class and Protocol two different entities with their specifics, so I need to know how the class is composed, if some methods without `override` keyword could be required by protocol..
All the basic things you need to know about the new class you found in some code. No?

Can I live with current syntax? Yes. Will change make a code more understandable for viewer in area of inheritance/conformance - Yes, especially if you need to review the code not in XCode/IDE but in some other viewer/web page. Should we make this change? I believe yes, but probably I'm not right in my opinion, so we discussing it here.

···

On 22.07.2016 17:32, Brandon Knope wrote:

I understand.

But why would you need to know if it's a class or a protocol to use the
type? What understanding comes from knowing this information?

I am honestly trying to understand the problem here and it feels like I'm
overlooking something.

Brandon

On Jul 22, 2016, at 10:12 AM, Charlie Monroe <charlie@charliemonroe.net > <mailto:charlie@charliemonroe.net>> wrote:

Coming to someone elses code, it adds an extra effort to understand the
declaration. Putting inheritance and conformance separately makes the
declaration easier to read. At least for me.

On Jul 22, 2016, at 4:05 PM, Brandon Knope <bknope@me.com >>> <mailto:bknope@me.com>> wrote:

Honest question: what is actually confusing about the current behavior?

I.E. What is important about knowing whether "DataSource" is a class or
a protocol?

I thought the blurred distinction was intentional?

Brandon

On Jul 22, 2016, at 9:47 AM, Charlie Monroe via swift-evolution >>>> <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

I agree that this is an issue. Mostly nowadays when more and more
classes in Swift do not have a superclass - it simply looks weird:

class MyClass: DataSource

One doesn't know whether "DataSource" is a class, protocol, etc.
Nevertheless, I do not feel that :: is the answer. I really liked, how
ObjC did it (which isn't possible with the generics now - is it?), but
what about something like this?

class BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
class MyClass: BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
extension MyClass [OtherProtocol]

On Jul 22, 2016, at 3:14 PM, Vladimir.S via swift-evolution >>>>> <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

I remember that this was discussed, but can't find any decision
regarding this.. So, as a last chance, don't we want in Swift 3.0, as
big source breaking change, separate class inheritance and protocol
conformance in syntax?

Sorry if there was a decision about this suggestions. Please let know
in this case.

I.e. when I see the following I can't understand if the class inherits
from base class and conforms to protocols or just conforms to two
protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other
suffix/prefix, or classes with 'T'/'C' prefix or something like this,
so I believe to improve the clarity of code we should separate in
syntax inheritance and conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and
conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

Thoughts?
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution


(Goffredo Marocchi) #13

I think that the current approach marks a regression in declarative expressiveness as the notion of extending a class over implementing a protocol is blurred while the concepts are IMHO not the same (the latter is about behaviour conformance not a is a relationship):

Class/struct B : Class/struct A <Protocol1 & Protocol2>

would be a clear and concise way to express it that would not be confused even at a quick glance.

···

Sent from my iPhone

On 22 Jul 2016, at 14:47, Charlie Monroe via swift-evolution <swift-evolution@swift.org> wrote:

I agree that this is an issue. Mostly nowadays when more and more classes in Swift do not have a superclass - it simply looks weird:

class MyClass: DataSource

One doesn't know whether "DataSource" is a class, protocol, etc. Nevertheless, I do not feel that :: is the answer. I really liked, how ObjC did it (which isn't possible with the generics now - is it?), but what about something like this?

class BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
class MyClass: BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
extension MyClass [OtherProtocol]

On Jul 22, 2016, at 3:14 PM, Vladimir.S via swift-evolution <swift-evolution@swift.org> wrote:

I remember that this was discussed, but can't find any decision regarding this.. So, as a last chance, don't we want in Swift 3.0, as big source breaking change, separate class inheritance and protocol conformance in syntax?

Sorry if there was a decision about this suggestions. Please let know in this case.

I.e. when I see the following I can't understand if the class inherits from base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other suffix/prefix, or classes with 'T'/'C' prefix or something like this, so I believe to improve the clarity of code we should separate in syntax inheritance and conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

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

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


(Vladimir) #14

The current syntax establishes a relationship.

  X: Y

means "X will have interface of Y". Note there's no mention of inheritance or protocol here: they both establish this relationship. This is why we can use

  z is Y

To check whether such relationship holds. Again, there's no need to worry whether Y is a class or protocol.

But we see that some mature languages like Java, C# and C++, Object Pascal has this distinction: Java with 'implements' keyword, C# with 'I' prefix for interfaces(their protocols), C++ with both `implements` and 'I' prefix conversion, Object Pascal with 'I' prefix. I.e. I believe that in any case new syntax will establish a relationship, but more clearly distinct inheritance with conformance to help the reader to understand the composition of the reviewed class code.

That being said, I agree that user have to look up Y's declaration to determine which one they are writing/reading. But is that a real issue? Why would you write/use "class X: Y {}" before knowing what Y is?

The problem arises not when you write/use but when you *read* someone's code, and sometimes you read that code not in XCode/IDE.

···

On 22.07.2016 19:25, Duan wrote:

Daniel Duan
Sent from my iPhone

On Jul 22, 2016, at 6:14 AM, Vladimir.S via swift-evolution <swift-evolution@swift.org> wrote:

I remember that this was discussed, but can't find any decision regarding this.. So, as a last chance, don't we want in Swift 3.0, as big source breaking change, separate class inheritance and protocol conformance in syntax?

Sorry if there was a decision about this suggestions. Please let know in this case.

I.e. when I see the following I can't understand if the class inherits from base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other suffix/prefix, or classes with 'T'/'C' prefix or something like this, so I believe to improve the clarity of code we should separate in syntax inheritance and conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

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


(David Hart) #15

It's probably too late by now, but I've always enjoyed C#'s naming convention of having interfaces (C# protocols) names start with capitale I:

IEquatable, IComparable

You get used to it and it's a nice way of avoiding name clashes between classes and protocols, which we currently handle in Swift by suffixing Protocol.

···

On 22 Jul 2016, at 15:14, Vladimir.S via swift-evolution <swift-evolution@swift.org> wrote:

I remember that this was discussed, but can't find any decision regarding this.. So, as a last chance, don't we want in Swift 3.0, as big source breaking change, separate class inheritance and protocol conformance in syntax?

Sorry if there was a decision about this suggestions. Please let know in this case.

I.e. when I see the following I can't understand if the class inherits from base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other suffix/prefix, or classes with 'T'/'C' prefix or something like this, so I believe to improve the clarity of code we should separate in syntax inheritance and conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

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


(Sean Alling) #16

I disagree with this suggestion. Both a protocol conformance & class inheritance define behavior conformance. If anything the protocol is more explicitly shown because the required properties and methods are conformed to within its declaration.

We used to define protocol conformance like so: <myProtocol>
This was removed to make protocol-oriented programming a bit more powerful I’d suspect. Also, it reads much easier in the current syntax.

If we were to change it, I would suggest a keyword ‘conform’ because your suggested operators don’t make it explicit what behavior is being defined. Whereas, the current syntax behavior is simple and easily understood.

Sean

···

I remember that this was discussed, but can't find any decision regarding
this.. So, as a last chance, don't we want in Swift 3.0, as big source
breaking change, separate class inheritance and protocol conformance in syntax?

Sorry if there was a decision about this suggestions. Please let know in
this case.

I.e. when I see the following I can't understand if the class inherits from
base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other suffix/prefix,
or classes with 'T'/'C' prefix or something like this, so I believe to
improve the clarity of code we should separate in syntax inheritance and
conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and
conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

Thoughts?


(Daniel Duan) #17

Daniel Duan

The current syntax establishes a relationship.

X: Y

means "X will have interface of Y". Note there's no mention of inheritance or protocol here: they both establish this relationship. This is why we can use

z is Y

To check whether such relationship holds. Again, there's no need to worry whether Y is a class or protocol.

But we see that some mature languages like Java, C# and C++, Object Pascal has this distinction: Java with 'implements' keyword, C# with 'I' prefix for interfaces(their protocols), C++ with both `implements` and 'I' prefix conversion, Object Pascal with 'I' prefix. I.e. I believe that in any case new syntax will establish a relationship, but more clearly distinct inheritance with conformance to help the reader to understand the composition of the reviewed class code.

I argue these syntax are ugly and unnecessary. Reason is in my initial reply.

That being said, I agree that user have to look up Y's declaration to determine which one they are writing/reading. But is that a real issue? Why would you write/use "class X: Y {}" before knowing what Y is?

The problem arises not when you write/use but when you *read* someone's code, and sometimes you read that code not in XCode/IDE.

I repeat: when you read X: Y, you would not understand what X is without knowing about Y.

···

Sent from my iPhone

On Jul 22, 2016, at 9:52 AM, Vladimir.S <svabox@gmail.com> wrote:

On 22.07.2016 19:25, Duan wrote:

Daniel Duan
Sent from my iPhone

On Jul 22, 2016, at 6:14 AM, Vladimir.S via swift-evolution <swift-evolution@swift.org> wrote:

I remember that this was discussed, but can't find any decision regarding this.. So, as a last chance, don't we want in Swift 3.0, as big source breaking change, separate class inheritance and protocol conformance in syntax?

Sorry if there was a decision about this suggestions. Please let know in this case.

I.e. when I see the following I can't understand if the class inherits from base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other suffix/prefix, or classes with 'T'/'C' prefix or something like this, so I believe to improve the clarity of code we should separate in syntax inheritance and conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

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


(Brandon Knope) #18

I guess my question comes down to this:

Is this a change for consistency OR is there actually a tangible benefit?

If it's a protocol: you know some methods are being implemented.
If it's a base class: it's possible that some methods are overridden

Between knowing these two things, what does the distinction *actually* bring about?

It's very possible I am not explaining myself properly.

Another way: so now you know it is most definitely a base class and not a protocol, what does this information allow you to do differently?

Basically, I am for introducing an "implements" or some new syntax for this distinction, but I just want to know if this change is just for consistency to separate inheritance and conformance OR if there is truly a benefit to knowing this distinction.

I think this is important to convince people to make a change like this. I understand the idea behind it but the important question is: why?

Thanks,
Brandon

···

On Jul 22, 2016, at 10:52 AM, Vladimir.S <svabox@gmail.com> wrote:

I don't understand the question, really. I need to know because I need to know :slight_smile:
I.e. I see new code, I'm trying to understand the structure of the class, its dependency, if all the base code of this class is inside this class or there is some 'base' code that is overriden, etc.. Class and Protocol two different entities with their specifics, so I need to know how the class is composed, if some methods without `override` keyword could be required by protocol..
All the basic things you need to know about the new class you found in some code. No?

Can I live with current syntax? Yes. Will change make a code more understandable for viewer in area of inheritance/conformance - Yes, especially if you need to review the code not in XCode/IDE but in some other viewer/web page. Should we make this change? I believe yes, but probably I'm not right in my opinion, so we discussing it here.

On 22.07.2016 17:32, Brandon Knope wrote:
I understand.

But why would you need to know if it's a class or a protocol to use the
type? What understanding comes from knowing this information?

I am honestly trying to understand the problem here and it feels like I'm
overlooking something.

Brandon

On Jul 22, 2016, at 10:12 AM, Charlie Monroe <charlie@charliemonroe.net >> <mailto:charlie@charliemonroe.net>> wrote:

Coming to someone elses code, it adds an extra effort to understand the
declaration. Putting inheritance and conformance separately makes the
declaration easier to read. At least for me.

On Jul 22, 2016, at 4:05 PM, Brandon Knope <bknope@me.com >>>> <mailto:bknope@me.com>> wrote:

Honest question: what is actually confusing about the current behavior?

I.E. What is important about knowing whether "DataSource" is a class or
a protocol?

I thought the blurred distinction was intentional?

Brandon

On Jul 22, 2016, at 9:47 AM, Charlie Monroe via swift-evolution >>>>> <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

I agree that this is an issue. Mostly nowadays when more and more
classes in Swift do not have a superclass - it simply looks weird:

class MyClass: DataSource

One doesn't know whether "DataSource" is a class, protocol, etc.
Nevertheless, I do not feel that :: is the answer. I really liked, how
ObjC did it (which isn't possible with the generics now - is it?), but
what about something like this?

class BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
class MyClass: BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
extension MyClass [OtherProtocol]

On Jul 22, 2016, at 3:14 PM, Vladimir.S via swift-evolution >>>>>> <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:

I remember that this was discussed, but can't find any decision
regarding this.. So, as a last chance, don't we want in Swift 3.0, as
big source breaking change, separate class inheritance and protocol
conformance in syntax?

Sorry if there was a decision about this suggestions. Please let know
in this case.

I.e. when I see the following I can't understand if the class inherits
from base class and conforms to protocols or just conforms to two
protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other
suffix/prefix, or classes with 'T'/'C' prefix or something like this,
so I believe to improve the clarity of code we should separate in
syntax inheritance and conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and
conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

Thoughts?
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution


(Leonardo Pessoa) #19

I don't see this as an issue and I'm sure not comfortable in being
more verbose here or complicating the language unnecessarily. This is
not a change that will bring either benefit or consistency as there
are no other cases to compare the use of colon but these and variable
declarations (which also use only one).

Perhaps a change to Xcode so it could colour differently classes and
protocols could be more benefic with no impact to the language. That
would solve the problem.

L

···

On 22 July 2016 at 12:13, Karl via swift-evolution <swift-evolution@swift.org> wrote:

What about if we defined subclasses with the “subclass” keyword instead of “class”? So you knew the first parameter was always going to be a base class?

That way we keep the single “:” everywhere else - where clauses, generic constraints lists, etc.

On 22 Jul 2016, at 15:14, Vladimir.S via swift-evolution <swift-evolution@swift.org> wrote:

I remember that this was discussed, but can't find any decision regarding this.. So, as a last chance, don't we want in Swift 3.0, as big source breaking change, separate class inheritance and protocol conformance in syntax?

Sorry if there was a decision about this suggestions. Please let know in this case.

I.e. when I see the following I can't understand if the class inherits from base class and conforms to protocols or just conforms to two protocols:

class MyClass : First, Second, Third {
}

We don't have a rule to name protocols with 'Protocol'/other suffix/prefix, or classes with 'T'/'C' prefix or something like this, so I believe to improve the clarity of code we should separate in syntax inheritance and conformance.

As I understand we should discuss changes in these areas:

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass, SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

My suggestions:

I) separate inheritance with double colon :

1. class inheritance :
class Child:: BaseClass

2. class conformance :
class Child: SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child:: BaseClass : SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child:: BaseProtocol1, BaseProtocol2

II) in class definition use parenthesis to separate inheritance and conformance :

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: (SomeProtocol1, SomeProtocol2)

3. class inheritance + conformance :
class Child: BaseClass (SomeProtocol1, SomeProtocol2)

4. protocol conformance for structs:
struct Struct: SomeProtocol1, SomeProtocol2
or
struct Struct: (SomeProtocol1, SomeProtocol2)
should be discussed

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

III) special word like 'conforms'

1. class inheritance :
class Child: BaseClass

2. class conformance :
class Child: conforms SomeProtocol1, SomeProtocol2
or
class Child conforms SomeProtocol1, SomeProtocol2

3. class inheritance + conformance :
class Child: BaseClass conforms SomeProtocol1, SomeProtocol2

4. protocol conformance for structs:
struct Struct: conforms SomeProtocol1, SomeProtocol2
or
struct Struct conforms SomeProtocol1, SomeProtocol2

5. protocol inheritance:
protocol Child: BaseProtocol1, BaseProtocol2

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

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


(Xiaodi Wu) #20

It would still cause confusion if you were only to conform to a single
protocol (P in "class A : P" is a class or a protocol?). This can be
solved in code but I don't think it is necessary.

The point made earlier is salient: if you know what P is, no clarification
is necessary; on the other hand, if you don't know anything else about P,
knowing whether P is a class or protocol is essentially useless even if
you're a reader. What could you possibly do with this information?

L

···

On Fri, Jul 22, 2016 at 12:42 PM, Leonardo Pessoa via swift-evolution < swift-evolution@swift.org> wrote:

On 22 July 2016 at 14:08, Goffredo Marocchi via swift-evolution > <swift-evolution@swift.org> wrote:
> I think that the current approach marks a regression in declarative
> expressiveness as the notion of extending a class over implementing a
> protocol is blurred while the concepts are IMHO not the same (the latter
is
> about behaviour conformance not a is a relationship):
>
> Class/struct B : Class/struct A <Protocol1 & Protocol2>
>
>
> would be a clear and concise way to express it that would not be confused
> even at a quick glance.
>
> Sent from my iPhone
>
> On 22 Jul 2016, at 14:47, Charlie Monroe via swift-evolution > > <swift-evolution@swift.org> wrote:
>
> I agree that this is an issue. Mostly nowadays when more and more
classes in
> Swift do not have a superclass - it simply looks weird:
>
> class MyClass: DataSource
>
> One doesn't know whether "DataSource" is a class, protocol, etc.
> Nevertheless, I do not feel that :: is the answer. I really liked, how
ObjC
> did it (which isn't possible with the generics now - is it?), but what
about
> something like this?
>
> class BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
> class MyClass: BaseClass [SomeDelegate, OtherDelegate, ProtocolX]
> extension MyClass [OtherProtocol]
>
>
> On Jul 22, 2016, at 3:14 PM, Vladimir.S via swift-evolution > > <swift-evolution@swift.org> wrote:
>
>
> I remember that this was discussed, but can't find any decision regarding
> this.. So, as a last chance, don't we want in Swift 3.0, as big source
> breaking change, separate class inheritance and protocol conformance in
> syntax?
>
>
> Sorry if there was a decision about this suggestions. Please let know in
> this case.
>
>
> I.e. when I see the following I can't understand if the class inherits
from
> base class and conforms to protocols or just conforms to two protocols:
>
>
> class MyClass : First, Second, Third {
>
> }
>
>
> We don't have a rule to name protocols with 'Protocol'/other
suffix/prefix,
> or classes with 'T'/'C' prefix or something like this, so I believe to
> improve the clarity of code we should separate in syntax inheritance and
> conformance.
>
>
> As I understand we should discuss changes in these areas:
>
>
> 1. class inheritance :
>
> class Child: BaseClass
>
>
> 2. class conformance :
>
> class Child: SomeProtocol1, SomeProtocol2
>
>
> 3. class inheritance + conformance :
>
> class Child: BaseClass, SomeProtocol1, SomeProtocol2
>
>
> 4. protocol conformance for structs:
>
> struct Struct: SomeProtocol1, SomeProtocol2
>
>
> 5. protocol inheritance:
>
> protocol Child: BaseProtocol1, BaseProtocol2
>
>
>
> My suggestions:
>
>
> I) separate inheritance with double colon :
>
>
> 1. class inheritance :
>
> class Child:: BaseClass
>
>
> 2. class conformance :
>
> class Child: SomeProtocol1, SomeProtocol2
>
>
> 3. class inheritance + conformance :
>
> class Child:: BaseClass : SomeProtocol1, SomeProtocol2
>
>
> 4. protocol conformance for structs:
>
> struct Struct: SomeProtocol1, SomeProtocol2
>
>
> 5. protocol inheritance:
>
> protocol Child:: BaseProtocol1, BaseProtocol2
>
>
>
> II) in class definition use parenthesis to separate inheritance and
> conformance :
>
>
> 1. class inheritance :
>
> class Child: BaseClass
>
>
> 2. class conformance :
>
> class Child: (SomeProtocol1, SomeProtocol2)
>
>
> 3. class inheritance + conformance :
>
> class Child: BaseClass (SomeProtocol1, SomeProtocol2)
>
>
> 4. protocol conformance for structs:
>
> struct Struct: SomeProtocol1, SomeProtocol2
>
> or
>
> struct Struct: (SomeProtocol1, SomeProtocol2)
>
> should be discussed
>
>
> 5. protocol inheritance:
>
> protocol Child: BaseProtocol1, BaseProtocol2
>
>
>
> III) special word like 'conforms'
>
>
> 1. class inheritance :
>
> class Child: BaseClass
>
>
> 2. class conformance :
>
> class Child: conforms SomeProtocol1, SomeProtocol2
>
> or
>
> class Child conforms SomeProtocol1, SomeProtocol2
>
>
> 3. class inheritance + conformance :
>
> class Child: BaseClass conforms SomeProtocol1, SomeProtocol2
>
>
> 4. protocol conformance for structs:
>
> struct Struct: conforms SomeProtocol1, SomeProtocol2
>
> or
>
> struct Struct conforms SomeProtocol1, SomeProtocol2
>
>
> 5. protocol inheritance:
>
> protocol Child: BaseProtocol1, BaseProtocol2
>
>
>
> Thoughts?
>
> _______________________________________________
>
> swift-evolution mailing list
>
> swift-evolution@swift.org
>
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution