Some questions on Slate syntax
shaping at earthlink.net
Sun Mar 27 00:40:52 PST 2005
> The whole "0-based" vs. "1-based" thing is misleading. When you are talking
> about "at:", you are locating some item in space by a coordinate - addressing.
> Memory is a spatial thing. Counting is just a different idiom entirely -
> searching. The thinking is, "I want that thing, there!", as opposed to, "Hmm,
> that's not what I want. Not that either. Oh, this one!"
Discrete, /ordered/ items are countable. Counting starts at 1.
Fundamentally, this issue is about naming a thing with a number representing its
/place/ in an ordered sequence. Order and counting both start at 1.
> Shaping wrote:
>>> 1. Why 0-based arrays?
>>> 0-based arrays don't seem to be as intuitive and easy to use as
>>> 1-based. If you want to create an array with x elements, the last
>>> element's index is x-1, rather than just plain old x. Not only is
>>> there an extra calculation involved, but if you're careless or just
>>> happen to typed a typo, you'll get one of those bugs that you'll want
>>> to slap yourself in the face with.
>> I have the same question/complaint, despite the slight improvement in
>> machine-efficiency it creates. The convention produces much programmer
>> inefficiency--extra thinking/translating/checking. Counting starts at 1.
More information about the Slate