Should we rename "class" when referring to protocol conformance?

(James F) #1

Agreed, AnyObject seems like all we need to limit protocols to reference types.

------------ Begin Message ------------
Group: gmane.comp.lang.swift.evolution
MsgID: <>


on Mon May 02 2016, David Sweeris <> wrote:

I was just thinking that:

   protocol Foo : reference {}

might be more to the point than:

   protocol Foo : class {}

I know that it’s currently a moot point because classes are the only*
reference-semantics type of type in Swift, but it’s conceivable that there might
some day be others. Anyway, I’m not saying it’s a big deal or anything, I’m just
trying to think of any source-breaking changes we might want to make before
Swift 3 drops, and this seems like an easy one.

- Dave Sweeris

* I’m not actually sure this is true. I have a very vague recollection about
some protocols getting reference semantics in certain circumstances, but the
memory is so hazy I’m not sure I trust it. Also I can’t remember if the
“indirect� keyword in enums affects the semantics.

Personally I have always felt “class� was an oddball special case here
that's unneeded because we have a perfectly good protocol that means the
same thing: AnyObject.


swift-evolution mailing list

------------- End Message -------------

From James F