Created
December 4, 2012 02:09
-
-
Save brson/4199903 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
fn main() { | |
let id: &Mat2<float> = &Matrix::identity(); | |
} | |
pub trait Index<Index,Result> { } | |
pub trait Dimensional<T>: Index<uint, T> { } | |
pub struct Mat2<T> { x: () } | |
pub struct Vec2<T> { x: () } | |
pub impl<T> Mat2<T>: Dimensional<Vec2<T>> { } | |
pub impl<T> Mat2<T>: Index<uint, Vec2<T>> { } | |
pub impl<T> Vec2<T>: Dimensional<T> { } | |
pub impl<T> Vec2<T>: Index<uint, T> { } | |
pub trait Matrix<T,V>: Dimensional<V> { | |
static pure fn identity() -> self; | |
} | |
pub impl<T> Mat2<T>: Matrix<T, Vec2<T>> { | |
static pure fn identity() -> Mat2<T> { fail } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment