Created
June 27, 2012 18:26
-
-
Save lkuper/3005870 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iface addable { fn plus(n: int) -> int; } | |
iface subtractable { fn minus(n: int) -> int; } | |
impl of addable for int { | |
fn plus(n: int) -> int { self + n } | |
fn minus(n: int) -> int { self - n } | |
} | |
impl of subtractable for int { | |
fn minus(n: int) -> uint { self - n as uint } | |
} | |
fn main() { assert 3.plus(1) == 5.minus(1); } // error: multiple applicable methods in scope |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment