on Tue Jun 07 2016, Matthew Johnson <swift-evolution@swift.org> wrote:

>> , but haven't realized
>> that if you step around the type relationships encoded in Self
>> requirements and associated types you end up with types that appear to
>> interoperate but in fact trap at runtime unless used in exactly the
>> right way.
>
> Trap at runtime?  How so?  Generalized existentials should still be
> type-safe.  

There are two choices when you erase static type relationships:

1. Acheive type-safety by trapping at runtime

  FloatingPoint(3.0 as Float) + FloatingPoint(3.0 as Double) // trap

2. Don't expose protocol requirements that involve these relationships,
   which would prevent the code above from compiling and prevent
   FloatingPoint from conforming to itself.

> Or are you talking about the hypothetical types / behaviors people
> think they want when they don’t fully understand what is happening...

I don't know what you mean here.  I think generalized existentials will
be nice to have, but I think most people will want them to do something
they can't possibly do.

-- 
-Dave

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to