I was treating this as a Mixin.

So the property from Object is Mixed into Tree and User but it isn't a
Subclass so any comparison between the two isn't possible.

But on reflection you bring up a very valid point.

*___________________________________*

*James⎥Head Of CEO*

*[email protected] <[email protected]>⎥supmenow.com <http://supmenow.com>*

*Sup*

*Runway East *

*10 Finsbury Square*

*London*

* EC2A 1AF *

On Thu, Mar 24, 2016 at 5:34 PM, Tino Heth <[email protected]> wrote:

> struct Object {
> let identifier: String
> }
>
> struct User: Object {
>
> }
>
> struct Tree: Object {
> }
>
> The last two structs get the identifier property "mixed" in but are unique
> types :)
>
>
> Is unique meant so that User-Objects can't be used as "Object"-Object
> parameters?
> I'm asking because this might be the biggest source of confusion with
> struct inheritance:
> As the two "child-structs" don't add new data to their parent, they would
> (technically) be compatible — but this is fragile, so it might be
> preferable to "hide" polymorphism by default, and maybe add an annotation
> to explicitly allow that a sub-struct can be used as its parent type.
> @compatible(Float) struct SpecialFloat: Float...
>
>
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to