Avatar
func foo<T: P>(_: T) extension P { func _forwardToFoo() { foo(self) } } func callFooOnEach(_ ps: [P]) { for p in ps { p._forwardToFoo() } }
3:36 AM
PのExisはP自身にconformしないが、extensionの中のselfを介してconformさせられる技
3:37 AM
It's awkward, but you can in fact "open" the existential by invoking a protocol extension method, which will give you Self as the dynamic type of the value inside the method, which you can then pass to generic functions: func foo(_: T) extension P { func _forwardToFoo() {...
3:37 AM
↑existensialのassoctype制約を無くすピッチ
3:39 AM
昔々から今までできなかったのは技術的な理由で、PWTがassoctypeを持ってなかったからで、今はそこがクリアされてる らしい