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=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,bf03d731a6ef511f X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!195.62.100.242.MISMATCH!newsfeed.kamp.net!newsfeed.kamp.net!188.40.43.213.MISMATCH!feeder.eternal-september.org!eternal-september.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!193.252.117.184.MISMATCH!news.wanadoo.fr!news.wanadoo.fr!not-for-mail Date: Tue, 09 Feb 2010 08:11:32 +0100 From: Pascal Obry Organization: Home - http://www.obry.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr-FR; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.5.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Copying rows in a two dimensional array. References: <12ezqn0wq0lmm$.s7nr5aueiwa4$.dlg@40tude.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <4b710a6c$0$927$ba4acef3@news.orange.fr> NNTP-Posting-Date: 09 Feb 2010 08:10:36 CET NNTP-Posting-Host: 82.124.147.129 X-Trace: 1265699436 news.orange.fr 927 82.124.147.129:8150 X-Complaints-To: abuse@orange.fr Xref: g2news1.google.com comp.lang.ada:9017 Date: 2010-02-09T08:10:36+01:00 List-Id: A pattern that I have used in some applications. I have an application that output structured strings, so I use something like that: type Index is range 1 .. 100; type Output is new String (Index); subtype Label is Index range 1 .. 10; subtype Code is Index range 12 .. 18; subtype Category is Index range 35 .. 50; ... You get the idea... Then the code is simply: Line : Output; Line (Code) := "..."; or Put_Line (Line (Category)); or if Line (Code) = "..." then An equivalent code using routines (a la C, using strcpy, strcmp) will never be as readable as the use of slices in Ada. I would even say that such code become obfuscated beyond anything acceptable to my taste. Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net - http://v2p.fr.eu.org --| "The best way to travel is by means of imagination" --| --| gpg --keyserver keys.gnupg.net --recv-key F949BD3B