<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px; color: rgba(0,0,0,1.0); margin: 0px; line-height: auto;"><div><blockquote type="cite" class="clean_bq" style="font-family: Helvetica, Arial; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: 'helvetica Neue', helvetica;">Fair enough. But in that case I think we want something that does exactly that: rejects classes, rather than indicating value semantics. We need to do this in a way that doesn’t lead to a situation where we used the word `value` to mean “value type”, and later we have the capability to very value semantics and really wish `value` could mean value semantics but that would be a breaking change we aren’t willing to make.</span></blockquote></div><p>Exactly, `any<class>` is just a constraint that indicates which type it can hold, where `any<struct>` or `any<enum>` are two constraints and (not yet existing) counterparts to `any<class>`.</p><p>The idea behind `any<struct>` (or `any<enum>`) might look like this:</p><p>func foo(struct: any<struct, SomeProtocol>)</p><p>Where it is clear that you have to provide a custom struct which conforms to `SomeProtocol`, you’re not constrained to just a single struct, you can build as many as you want it it’s your desire. :)</p></div> <div>Lets just imagine we already have `any<…>` and we also get `oneOf<…>` or `one<…>` which picks only one constraint at compile time and proceeds.</div><div><br></div><div>Here is what you could do for extendable types:</div><div><br></div><div>typealias AnyValue = one<any<struct>, any<enum>></div><div><br></div><div>func boo(value: any<AnyValue, SomeProtocol>)</div><div><br></div><div>Not sure if we’ll get there or not but its a nice imagination. :)</div><div><br></div><div>I’m not exactly in favor of using `any<class>` instead of AnyClass but I’m openminded. :)</div><div><br></div><div>One problem to solve is the conformance to protocols:</div><div><br></div><div>If we’ll get `any<…>` and depricate `AnyClass` `AnyObject` we cannot do this directly:</div><div><br></div><div>protocol A: any<class> {}</div><div>protocol B: any<ProtocolX, ProtocolY></div><div><br></div><div>We still need a typealias as a workaround:</div><div><br></div><div>typealias AnyClass = any<class></div><div>typealias AnyXY = any<ProtocolX, ProtocolY></div><div><br></div><div>protocol A: AnyClass {} furthermore is this protocol equivalent to protocol A: class {} ???</div><div>protocol B: AnyXY {}</div><br> <div id="bloop_sign_1463812101085146880" class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div> <br></body></html>