For example, see the AbstractNode class in the flutter sources.
How can it cross-compile these and retain type safety (or as much as possible with C#?). I thought maybe it could rewrite the class to use a covariant generic interface.
So for AbstractNode, for example, it would generate something like this interface (not sure if this would work):
public interface INode {}
public interface INode<out T> : INode
{
INode owner { get; } // had to loosen the type here, not sure if we can do better?
INode<INode<T>> parent { get; }
int depth { get; set; }
bool attached { get; }
void attach(INode owner);
void redepthChildren();
void detach();
}
public class AbstractNode<T> : INode<T> {
...etc...
protected void dropChild<TChild>(INode<TChild> child) { ...etc.. }
}
For example, see the
AbstractNode
class in the flutter sources.How can it cross-compile these and retain type safety (or as much as possible with C#?). I thought maybe it could rewrite the class to use a covariant generic interface.
So for
AbstractNode
, for example, it would generate something like this interface (not sure if this would work):