From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border3.nntp.ams.giganews.com!nntp.giganews.com!news.osn.de!diablo2.news.osn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Possible for Ada 2020: "Cursors" for Arrays Date: Tue, 04 Jun 2013 08:19:00 +0200 Organization: Tidorum Ltd Message-ID: References: <55016aa4-4d69-4fd9-a2c9-a7eb7d3b00c5@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net 2dmh6bGoMViNzEzU5MFgTw++n/x0O+TcJsKh83BGdRlkvncMSm Cancel-Lock: sha1:AvNP/1g7Oq2PKdV25c85E6WADTo= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 In-Reply-To: <55016aa4-4d69-4fd9-a2c9-a7eb7d3b00c5@googlegroups.com> X-Original-Bytes: 2278 Xref: number.nntp.dca.giganews.com comp.lang.ada:181793 Date: 2013-06-04T08:19:00+02:00 List-Id: On 13-06-04 03:09 , Shark8 wrote: > In a few threads a few people have expressed a desire > to be able to initialize Arrays based on some formula > usually including the indices. In order to do this we > need some sort of "cursor"-type/attribute. Maybe... > So, let us propose a cursor-attribute so that some array > type, T1, defined as > type T1 is Array( 1..10 ) of Integer; > could have a variable initialized as follows: > V1 : T1:= (others => T1'Cursor'Index) > resulting in V1 getting (1,2,3,4,5,6,7,8,9,10); I think it would be better to build this ability from syntax similar to the quantified expressions - "for all/some I in => ...". To avoid ambiguities when the array elements are Boolean we should use a new keyword instead of "all" or "some". I would also not put this after "others", but directly as an "array_component_association": V1 : T1 := (for each I in T1'Range => I); But this would make yet another useful word ("each") reserved... Perhaps we can do without any keyword: V1 : T1 := (for I in T1'Range => I); > My question: does this look reasonable, or is it > just superfluous? Superfluous, yes, perhaps with the exception of some corner cases such as initializing large systematic arrays during pre-elaboration. But nice to have, why not. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .