[swift-evolution] Should we rename "class" when referring to protocol conformance?

Patrick Smith pgwsmith at gmail.com
Wed May 4 09:00:57 CDT 2016


**  
**

  

On May 4 2016, at 5:37 pm, James Froggatt <conductator at ntlworld.com>
wrote:  

> I was thinking that requiring instance properties would mean the value could
only be a struct, but rethinking, I realise computed properties would work
fine for protocol conformance, so this isn't actually true.

>

>  

>

> I agree with your support of focusing on interface. Your implications for
AnyObject and AnyValue are interesting - that reference-type and value-type
semantics are a kind of interface…

>

>  

>

> One thing occurs to me, thinking about this: what if protocols could require
enum cases? This could allow a Failable protocol with .failure(ErrorType), for
example; or Nillable, which could implement NilLiteralConvertible for enums
with a .none case… I'm not sure, maybe this wouldn't be so useful in practice?

  

Basically you are asking to initialize with something, and not read from it
later. So better to just have a:

  

init(error: ErrorType)

  

I think. And use NilLiteralConvertible!

  

Enums are tightly coupled to their structure, and I imagine compile down to
some sort of bit offset, so you can’t really have a generic .failure case that
would work with all enums, as they will be at different offsets in the enum.

  

>  

>

> From James F

  

**Patrick Smith**  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160504/6d090fcd/attachment.html>


More information about the swift-evolution mailing list