comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: reference to a name variable
Date: Tue, 28 Jul 2009 11:25:10 -0700 (PDT)
Date: 2009-07-28T11:25:10-07:00	[thread overview]
Message-ID: <fc064dea-e4e7-4874-b4d2-28ea3a187ce9@b15g2000yqd.googlegroups.com> (raw)
In-Reply-To: a3d51cd7-d087-479e-816d-213dd77c078d@d4g2000yqa.googlegroups.com

On Jul 28, 3:51 pm, Chrono <pablit...@gmail.com> wrote:
> On 24 jul, 08:03, Stephen Leake <stephen_le...@stephe-leake.org>
> wrote:
>
> > Pablo <pablit...@gmail.com> 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 = IntegerValue(MyString),
>
> > My_Integer := 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.



  reply	other threads:[~2009-07-28 18:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-23 19:08 reference to a name variable Pablo
2009-07-23 20:02 ` Hibou57 (Yannick Duchêne)
2009-07-23 20:26   ` Dmitry A. Kazakov
2009-07-24 11:03 ` Stephen Leake
2009-07-28 13:51   ` Chrono
2009-07-28 18:25     ` Ludovic Brenta [this message]
2009-07-30 14:37       ` Chrono
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox