[Submission] D Slices
eles
eles at eles.com
Tue May 31 09:10:24 PDT 2011
> 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.
Actually, I think 0-based vs. 1-based is of little importance in the
fact if limits should be closed or open. Why do you think the
contrary?
Why it is "natural" to use open-limit for 0-based? I think it is
quite subjective. Why to the right and not to the left?
Can you redirect me towards an example of such norm? I have no
knowledge of that use.
I hope some day someone would not have to write a paper like http://
drdobbs.com/blogs/cpp/228701625 but targetting... D's biggest mistake
was to use open-limit on the right.
I think the idea of dropping array information to just a pointer was
seen as very natural to Kernigan and Ritchie. Otherwise they would
have not used it.
More information about the Digitalmars-d
mailing list