Hi, Since I've been hibernating for a while, I'm not really familiar with Rust's type class system, but after discussing it with Graydon a bit, I would be curious to hear (probably from Marijn) about the similarities and differences between it and instance chains as described in this paper by some of my former colleagues:
http://web.cecs.pdx.edu/~jgmorris/pubs/morris-icfp2010-instances.pdf The problem the paper addresses is in Haskell, where having multiple instances in scope for the same class and type can cause unpredictable behavior. (The paper explains the basic problem in more detail pretty well.) It seems like there's an analogous issue in Rust when you import multiple sets of methods for the same type class, which I understand is handled with a compile failure. A difference is that with instance chains, an instance is not a "first-class" thing that you can import (like an item in Rust terminology) -- rather, you use type-level if-then expressions to disambiguate which instances apply. >From a research perspective, it would be good to compare/contrast what Rust is doing with the instance chains approach, since I think they're addressing some similar problems. Cheers, Tim -- Tim Chevalier * http://catamorphism.org/ * Often in error, never in doubt “I cannot hide my anger to spare you guilt, nor hurt feelings, nor answering anger; for to do so insults and trivializes all our efforts. Guilt is not a response to anger; it is a response to one’s own actions or lack of action.” -- Audre Lorde _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
