[rust-dev] iface type parameter restrictions

Niko Matsakis niko at alum.mit.edu
Mon Apr 16 20:24:19 PDT 2012


On 4/16/12 6:23 PM, Steven Blenkinsop wrote:
> Motivated by the thread "paring back the self type to be, well, just a 
> type" 
> <https://mail.mozilla.org/pipermail/rust-dev/2012-April/001661.html> I 
> decided to see how far I could get toward implementing monads given 
> the self type [constructor] as-is. I ran into several things that got 
> in the way, so I'm wondering how many of these are intentional. Here 
> are some reduced test cases and the compiler errors they gave. The 
> last one is obviously a compiler bug.

I haven't read through these all in detail, but these kinds of tests are 
always helpful. I was planning to go through soon and make up some more 
twisted torture tests of recursive iface bounds and so forth, so now you 
gave me a headstart. :)

The first message (about enums) reflects a somewhat outdated rule dating 
from the time in which enums were the only nominal type in our type 
system (meaning a type whose equality is based on its name, not its 
definition), and hence all cycles had to go through an enum.  Interface 
types are also nominal (and class types too) so we ought to loosen that 
rule.


Niko


More information about the Rust-dev mailing list