On 3/4/14 8:32 PM, Josh Matthews wrote:
I was actually thinking that we could rewrite methods that look like this:

fn TakesANode(node: &JS<Node>)

to read as follows:

fn TakesANode<N: NodeBase>(node: &JS<N>) {
   let node: JS<Node> = NodeCast::from(node);

That would enable passing any Node-derived type as a parameter;
unfortunately the cast is still present in the callee, but it could
clean up callers a bit.

I suspect the struct inheritance stuff that's slated for post-Rust-1.0 will help here. (Actually Nick Cameron has a partial implementation already. Perhaps we should look into merging it.)

Patrick

_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to