> On 09 Apr 2014, at 20:46, Kevin Ballard <[email protected]> wrote:
> 
> Why? Zero is the additive identity.

Zero is _an_ additive identity for numbers, but not for vectors or matrices.

use std::slice::Items;
use std::iter::RandomAccessIterator;
use std::num::Zero;

Items is a RandomAccessIterator, but a RandomAccessIterator is not an Items. 0 
is an additive identity, but an additive identity is not 0. You can't assign a 
zero to a 2x2 matrix, and therefore this trait is incorrectly named. The 
following just looks wrong:

let m: Matrix = Zero::zero();

> AdditiveIdentity is the only reasonable alternative, but that's a mouthful of 
> a name and I think changing the name to this would be more confusing.

Naming a trait something that it's not is even more confusing. I don't think we 
should give an incorrect name to this trait on the grounds of the correct name 
being longer. Just look at RandomAccessIterator.

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to