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.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c63aa81a67eceb8f X-Google-Attributes: gid103376,public From: "Nick Roberts" Subject: Re: Ragged Array Proposal Date: 1999/09/24 Message-ID: <37ebb11e@eeyore.callnetuk.com>#1/1 X-Deja-AN: 529122134 References: <37e7c08e@eeyore.callnetuk.com> <7satei$e2q$1@nnrp1.deja.com> <37EA4E91.1D4D1FC@averstar.com> <37eaa24b@eeyore.callnetuk.com> X-Original-NNTP-Posting-Host: da129d149.dialup.callnetuk.com X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Trace: 24 Sep 1999 18:13:02 GMT, da129d149.dialup.callnetuk.com X-MSMail-Priority: Normal Newsgroups: comp.lang.ada Date: 1999-09-24T00:00:00+00:00 List-Id: Hyman Rosen wrote in message news:t7k8ph19um.fsf@calumny.jyacc.com... [...] | Is it possible to do something similar in Ada? | Something like (forgive my fractured pseudo-Ada syntax) - | | apple: aliased String(5) := "apple"; | orange: aliased String(6) := "orange"; | pear: aliased String(4) := "pear"; | | type StringPtr is access String(<>); | | fruits: StringPtr[1..3] := (apple'access, orange'access, pear'access); This is one of the unappealing alternatives I was talking about. In Ada 95, one would have to write something like: Fruit_001: constant aliased String := "Apple"; Fruit_002: constant aliased String := "Orange"; Fruit_003: constant aliased String := "Pear"; ... type String_Sight is access constant String; Fruits: constant array (Positive range <>) of String_Sight := (Fruit_001'Access, Fruit_002'Access, Fruit_003'Access, ...); Whereas with ragged arrays, one need only write: Fruits: constant array (Positive range <>) of String := ("Apple", "Orange", "Pear", ...); Much simpler and clearer, don't you think? ------------------------------------- Nick Roberts http://www.callnetuk.com/home/nickroberts http://www.adapower.com/lab/adaos -------------------------------------