Smart slicing

Jesse Phillips jessekphillips at gmail.com
Sun Mar 30 16:19:16 PDT 2008


On Thu, 20 Mar 2008 20:48:34 -0400, bearophile wrote:

> Trevor Parscal Wrote:
>> Allowing out-of-bounds indexes hides bugs. An out of bounds index
>> should always be an error which is considered exceptional.
> 
> I (like all all Ruby and Python programmers) use such things all the
> time, and only once in a while it actually produces a bug in my
> programs, so I presume you are wrong.

He is not referring to when it is the programmers intent to do it. It is 
the times when an index has gone out of bounds by accident.

auto str = "Hello";
auto i = 0;

while(true) {
     writefln(str[i++]);
}

ooops, I forgot an exit condition.



More information about the Digitalmars-d mailing list