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,6085ae1d74309e83 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!b15g2000yqd.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: reference to a name variable Date: Tue, 28 Jul 2009 11:25:10 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <9129a8e6-1aba-430c-bfbc-3154026697b8@i18g2000pro.googlegroups.com> NNTP-Posting-Host: 153.98.68.197 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1248805510 18037 127.0.0.1 (28 Jul 2009 18:25:10 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 28 Jul 2009 18:25:10 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b15g2000yqd.googlegroups.com; posting-host=153.98.68.197; posting-account=pcLQNgkAAAD9TrXkhkIgiY6-MDtJjIlC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7380 Date: 2009-07-28T11:25:10-07:00 List-Id: On Jul 28, 3:51=A0pm, Chrono wrote: > On 24 jul, 08:03, Stephen Leake > wrote: > > > Pablo writes: > > > I have an integer variable which I'd like to set dinamically equal to > > > a value of a variable that I don't know at priori. Say as: > > > I want to set My_Integer =3D IntegerValue(MyString), > > > My_Integer :=3D Integer'Value (MyString); > > > -- > > -- Stephe > > Stephe, the idea is this really, instead of MyString is not a number > string, it's a string whose name is the name of a integer variable, > and it's the value of this variable what I want. This would work if I > had a string like "123", so Integer'Value("123") would give me 123. > When I try with a real naming string (instead of a number string), > program keeps waiting for an entry so it suspends itself... Like Dmitry said, a map (i.e. a container of name-value pairs, where names are Strings and values are integers) seems the best solution. See Ada.Containers.Hashed_Maps. However I'm curious to know why you need this? What is the higher- level problem you're trying to solve? -- Ludovic Brenta.