@kornel You’d still have to deal with issues of multiple implementations. That is a strict subset of the idea discussed here.
–
Edit: I’m out of replies for the day, so I’m posting a response to @Ixrec here as well:
it also appears to say that any non-generic function lacking the same exact set of impl annotations would simply not compile if it called or was called by bar
Yes, that’s not what I was suggesting, but I don’t see where the gist suggests this is the case.
–
I have to think more about @ExpHP’s earlier post. It is a good point, and definitely raises a property of Rust that should be preserved.
–
Edit2: (since I’m out of replies – sorry, this will make it hard to follow in the future so after this I’ll stop)
@Ixrec the problem is that Module2::bar is being called with a hash type whose first parametric type is a uint : Module1::hash when it explicitly required a type uint : Module2::hash. The non-genericity of Module1::foo nor it’s absent impl annotations has nothing to do with it, which is why I was confused by your statement. It could be made to compile as long as h had the proper type, for instance
fn foo() -> str {
let h : @ht::t<uint: Module2::hash, str> = ht::create();
ht::put(ht, 3u, "hi"); // 3u.hash() == 3u here
ret Module2::bar(h);
}
should compile (using the notation from the gist). I think the confusion was on my part, I thought you were saying that foo had to be generic or specify the same type parameters as bar in order to get it to compile, which isn’t the case.