2012-07-04 16:53:12 -05:00
|
|
|
/// An interface for numbers.
|
2012-06-07 19:25:54 -05:00
|
|
|
|
2012-07-26 16:42:44 -05:00
|
|
|
trait num {
|
2012-06-14 20:18:43 -05:00
|
|
|
// FIXME: Cross-crate overloading doesn't work yet. (#2615)
|
|
|
|
// FIXME: Interface inheritance. (#2616)
|
2012-07-26 16:42:44 -05:00
|
|
|
pure fn add(&&other: self) -> self;
|
|
|
|
pure fn sub(&&other: self) -> self;
|
|
|
|
pure fn mul(&&other: self) -> self;
|
|
|
|
pure fn div(&&other: self) -> self;
|
|
|
|
pure fn modulo(&&other: self) -> self;
|
|
|
|
pure fn neg() -> self;
|
2012-06-07 19:25:54 -05:00
|
|
|
|
2012-07-26 16:42:44 -05:00
|
|
|
pure fn to_int() -> int;
|
|
|
|
pure fn from_int(n: int) -> self; // FIXME (#2376) Static functions.
|
2012-07-05 16:17:16 -05:00
|
|
|
// n.b. #2376 is for classes, not ifaces, but it could be generalized...
|
2012-06-07 19:25:54 -05:00
|
|
|
}
|
|
|
|
|