[rust-dev] Appeal for CORRECT, capable, future-proof math, pre-1.0

Brendan Zabarauskas bjzaba at yahoo.com.au
Sun Jan 12 08:29:00 PST 2014


On 13 Jan 2014, at 12:34 am, Owen Shepherd <owen.shepherd at e43.eu> wrote:

> But I also feel that by making the unchecked ones the shorter name, the language would be implicitly sending a message that they're preferred.

Custom operator time!

Say hello to our checked operators:

    trait CheckedAdd {
        fn infix +| (a: &Self, b: &Self) -> Self;
    }

    trait CheckedSub {
        fn infix -| (a: &Self, b: &Self) -> Self;
    }

    trait CheckedMul {
        fn infix *| (a: &Self, b: &Self) -> Self;
    }

xD

~Brendan


More information about the Rust-dev mailing list