Issue 16597: Indexing in sequence access expressions should be 0-based (alf-rtf) Source: (, ) Nature: Revision Severity: Significant Summary: The proposal is to change For example, given the sequence a = Integer[]{10, 20, 30, 40} the sequence access expression a[3] evaluates to 30. Note that indexing is from 1. to For example, given the sequence a = Integer[]{10, 20, 30, 40} the sequence access expression a[2] evaluates to 30. Note that indexing is from 0. Indexing in sequence access expressions should be 0-based. The main reason is that most popular languages use 0-based indexing. In particular this is true for Java, which Alf is syntactically compatible with at the minimum conformance level. Besides from confusing users, 1-based indexing makes it unnecessary hard to copy/paste existing Java code to be reused in an Alf context. Also, the ALF standard says the following in the introduction: "Alf has a largely C-legacy (“Java like”) syntax, since that is most familiar to the community that programs detailed behaviors." In the same spirit of being familiar to the community, Alf really should use 0-based indexing. Resolution: The FTF agrees that this is an issue worth considering, but, due to lack of time, decided to defer its resolution to a future RTF working on this specification. Revised Text: None Disposition: Deferred Revised Text: Actions taken: October 14, 2011: received issue October 5, 2012: drferred Discussion: End of Annotations:===== m: webmaster@omg.org Date: 14 Oct 2011 05:49:00 -0400 To: Subject: Issue/Bug Report ******************************************************************************* Name: Mattias Mohlin Employer: IBM mailFrom: mattias.mohlin@se.ibm.com Terms_Agreement: I agree Specification: ALF Section: 8.3.16 FormalNumber: ptc/2010-10-05 Version: FTF ­ Beta 1 Doc_Year: Year Doc_Month: Month Doc_Day: Day Page: 61-62 Title: Indexing in sequence access expressions should be 0-based Nature: Revision Severity: Significant CODE: 3TMw8 B1: Report Issue Description: The proposal is to change For example, given the sequence a = Integer[]{10, 20, 30, 40} the sequence access expression a[3] evaluates to 30. Note that indexing is from 1. to For example, given the sequence a = Integer[]{10, 20, 30, 40} the sequence access expression a[2] evaluates to 30. Note that indexing is from 0. Indexing in sequence access expressions should be 0-based. The main reason is that most popular languages use 0-based indexing. In particular this is true for Java, which Alf is syntactically compatible with at the minimum conformance level. Besides from confusing users, 1-based indexing makes it unnecessary hard to copy/paste existing Java code to be reused in an Alf context. Also, the ALF standard says the following in the introduction: "Alf has a largely C-legacy (.Java like.) syntax, since that is most familiar to the community that programs detailed behaviors." In the same spirit of being familiar to the community, Alf really should use 0-based indexing.