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,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: Ray Blaak Subject: Re: Ragged Array Proposal Date: 1999/09/22 Message-ID: #1/1 X-Deja-AN: 528527141 Sender: blaak@vault80.infomatch.bc.ca References: <37e7c08e@eeyore.callnetuk.com> <7satei$e2q$1@nnrp1.deja.com> X-Trace: news.bctel.net 938064500 207.34.170.80 (Wed, 22 Sep 1999 22:28:20 PDT) NNTP-Posting-Date: Wed, 22 Sep 1999 22:28:20 PDT Newsgroups: comp.lang.ada X-Complaints-To: news@bctel.net Date: 1999-09-22T00:00:00+00:00 List-Id: Ted Dennison writes: > Also for your example you say "the various ways of doing the equivalent > thing in Ada 95 are all unappealing." I but I can do the equivalent > thing in Ada 95 in only 2 more lines of code: > > type Command_String_Ptr is access all String; > for Command_String_Ptr'Storage_Size use 1024; > > type Command is (Cut, Copy, Paste, ...); > > Labels: constant array (Command) of Command_String_Ptr := > (Cut => new String'("Cu&t"), > Copy => new String'("&Copy"), > > Paste => new String'("&Paste"), > ...); The problem with this approach is that the data is duplicated. It is both in the static data area of the program (i.e. the string constants), and in the heap. In Ada95, to avoid duplicating the data, the approach is tedious (i.e. having an aliased constant for each string, and assigning their 'Access values into the array). -- Cheers, The Rhythm is around me, The Rhythm has control. Ray Blaak The Rhythm is inside me, blaak@infomatch.com The Rhythm has my soul.