Let's jump back to Mixin
example. How can I allow fin
inlining. If I have this:
// Module A
import Mixin
protocol A: Mixin {...}
extension A { /* Implements Mixin */ }
func take(a: A) {...}
struct Concrete: A {...}
// Application
import A
protocol B: Mixin {...}
extension B { /* Implements Mixin */ }
We want to compile module A
into a binary, and ship it to Application, which is doable. Now, what should happen if I do this in the Application
module?
extension Concrete: B {...}
If it shouldn't be allow, I'm not sure of the utility of the manually resolution that we've been working hard for.
If it should be manually resolved, things will be getting interesting. What should happen if I call take(a: Concrete())
from Application? It'd surely use the resolved implementation. What if I call it from within A
? It could
- Uses the resolved implementation. This will surely prevent inlining when compile a binary for
A
since it can't ascertain the actualfin
at that time. - Uses the
A.mixin
implementation. It's, well, is a little weird, but somewhat reasonable.
Either way, welcome to An Implementation Model for Rational Protocol Conformance Behavior