[Submission] D Slices

Michel Fortin michel.fortin at michelf.com
Tue May 31 08:50:10 PDT 2011


On 2011-05-31 11:10:59 -0400, eles <eles at eles.com> said:

> I agree that the issue is not simple (else, there would have been no
> "war"). I know no other examples where open-right limits are used. I
> use (intensively) just another language capable of slicing, that is
> Matlab. It uses the closed-left and closed-right limits and I tend to
> see it as a winner in the engineering field, precisely because of its
> ability to manipulate arrays (its older name is MATrix LABoratory and
> this is exaxtly why I am using it for).

I don't think you can enter this debate without bringing the other war 
about zero-based indices vs. one-based indices. Matlab first's index 
number is number one, and I think this fits very naturally with the 
closed-right limit. In many fields, one-based indices are common 
because they are easier to reason with. But in computers, where the 
index is generally an offset from a base address, zero-based is much 
more prevalent as it better represents what the machine is actually 
doing. And it follows that open-ended limits on the right are the norm.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list