Smart slicing

Trevor Parscal trevorparscal at hotmail.com
Thu Mar 20 17:30:19 PDT 2008


bearophile Wrote:

> Trevor Parscal:
> > Allowing negetive indexes seems like a nice feature - but in fact acts to hide bugs in software, which is something that D makes efforts not to do.
> 
> In practice it rarely produces bugs, but note that my whole post was not about negative indexes, it was about out-of-bound arrays (positive) indexes.
> 
> Bye,
> bearophile

Allowing out-of-bounds indexes hides bugs. An out of bounds index should always be an error which is considered exceptional.

If you handle the index wrapping yourself, it's obvious to everyone that in that particular case that would be an OK thing to do - in all other cases, it could potentially be an error..

- Trevor



More information about the Digitalmars-d mailing list