I program scientific and technical applications. Mainly engineering but
also geophysics, physics, mathematics, statistics, epidemiology. I deal
with masses of data, much of which needs to be visualized.
So my answer are biased.
On Mon, 4 Nov 2019, Brad Chamberlain wrote:
Indexing cases that may or will need to change
----------------------------------------------
So then what cases do default to 1-based indexing today?
* tuples (e.g., today `myTuple(1)` returns the first element; in the
proposal, `myTuple(0)` would)
See your questions.
* strings (e.g., given `s = 'hello'`, today s[1] is 'h'; in the
proposal, s[1] would be `e`)
See your questions.
* lists (e.g., myList[1] returns the first element in the list today;
in the proposal, myList[0] would)
See your questions.
* array types inferred from literals (e.g., `var A = ["hi", "there"];`
results in A having type `[1..2] string` today; in the proposal, it
would have type `[0..1] string`)
Let's consider,
var A = [ 1.0, 2.0 ];
assert (A[i] == i);
If that assertion fails, you have lost me on the spot.
* numberings of things like dimensions (e.g., `myDom.dim(1)` returns
information about the first dimension of a domain today; in the
proposal, `myDom.dim(0)` would).
See your questions.
Questions we'd like you to answer
---------------------------------
Here are some questions we'd like your thoughts on; you can either mail
your responses back to me or to the list(s) as you prefer. Each
question asks you to rate something on a scale of 1-7, though we'd also
be interested in any arguments or thoughts behind your numerical score.
Q: If we were designing Chapel from scratch, or you were approaching it
for the first time today, would you be happiest if its indexing was
1-based or 0-based?
1 = I'd be happiest if it were 1-based
1.
Q: Given that Chapel is not brand new, how enthusiastic is your support
for making it 1-based or 0-based today?
1 = I feel strongly that it should remain 1-based
1.
Q: How much do you worry about the impact such a change would have on
Chapel code that you've already written?
1 = Very worried: I expect the impact to be significant and would
not be enthusiastic about updating my code.
Very worried. The rest of the sentence is not the point in my case.
Q: If we were to make the change and you are worried about it, would it
be possible/helpful if we were to help update your code?
1 = No, not possible: I'm not permitted to share my code with you
Not Applicable. Anyway, I have shared some of my code with you.
Further Background for those who are interested
-----------------------------------------------
I have used BCPL/C/C++ for one reason or another for almost as long as
they all have existed. So I have some experience with 0-based languages.
Whether I know much (or even enough) is another (interesting) question.
I am not as wise as the authors of the above 3 languages. But younger!
I use/have-used Python (a lot) over the last decade+.
We chose 1-based indexing in these cases because, at that time, we were
thinking primarily in terms of programmers coming to Chapel from C/C++,
Java, Fortran, and Matlab, where the first two groups are 0-based and
the latter two are 1-based. We chose to go with 1-based programming
fairly arbitrarily, on the argument that counting from 1 is more natural
to most people;
I agree. Programmers of scientific and technical applications would too.
That's why 1, 2, 3, 4, .. are, well at least were, called natural numbers.
and being a language focused on productivity, we wanted to maximize our
appeal.
Ever since learning Fortran ??, I have been looking for an alternative.
With Chapel, as it stands now, a truly viable alternative exists.
I have used C or C++ for 30+ years for scientific work. It was the only
true alternative until now over Fortran ??, well since the mid 1980s.
Chapel seems to address many of the problem I have seen over that time in
C/C++ and appears to me to be able to address the future better, at least
for scientific and technical applications. Not talking systems programming
or compiler writing or ...
Regards - Damian
Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users