Hi
I’ve ask this question in user forum and I haven’t received any convincing answer so I was suggested to post it here.
Intuitively, we expected that extern
should preserve the variance of fn
wrt arguments and output types. However, for the sake of mathematical rigor, I’d like to see how it is deduced using xform or glb.
By definition primitives are bivariant, including extern type
(Variance in Rust under Variance of Built-in Type Constructors). So in order to deduce the variance of extern fn(T)
wrt T, it seems we should use xform, because it’s like a type composition. Therefore, it implies the bivarince (since bivariance is dominant to the left) and this is wrong and it matches the intuition, however, not my mathematical mental model.
Finally, this shows that to derive the variance of extern fn(T)
glb was used, but isn’t glb for type aggregator? is extern
a form a type aggregation and how?