> On May 2, 2016, at 6:55 AM, David Sweeris via swift-evolution
> <swift-evolution@swift.org> 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.
Functions/closures have reference semantics, but they can't conform to
protocols. Anyway, that's not the important question; the important question
is why we would add a new kind of first-class reference type to the language —
that can implement class protocols, no less — instead of, at most, calling it a
new kind of class.
> 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.
Other than permitting otherwise-infinite types, no.
John.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution