From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED.2uCIJahv+a4XEBqttj5Vkw.user.gioia.aioe.org!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Newbie question # 2 Date: Thu, 6 Aug 2020 21:41:35 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <8b2858e0-e69c-4a22-ad51-a6a7c51e7a7do@googlegroups.com> NNTP-Posting-Host: 2uCIJahv+a4XEBqttj5Vkw.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader01.eternal-september.org comp.lang.ada:59676 List-Id: On 06/08/2020 20:40, Ian Douglas wrote: > I did try Google search and assorted books but could not find answer. > > In PHP, let's say we have a variable $fruit which contains the string "banana". > > In PHP, if I do $$fruit, then it creates a variable $banana, which I can then do things with. You cannot, because you do not know its name before program run, so you will have to keep on using indirection "$fruit" rather than the direct name "banana". > Does Ada support any such concept of taking the contents of one variable and using THAT as a variable? Sure. Indirection is supported in almost all known programming languages. You can have a map: string->value. Here string is "banana", or an array: index->value etc. > I'm reading in a file which has a name of an object followed by some properties so I want to use the name as a variable ... > File is something I created, so it's not some random stuff, and the variables will be existing already. This would be filling a predefined map reading it from the file in the form of (key,value) pairs. Just deserialization of a map with fixed keys. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de