From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.9 required=3.0 tests=BAYES_00,NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.6 Subject: Re: Is there a way to see if a value is declared as a constant Newsgroups: comp.lang.ada References: From: ldries46 Date: Sat, 18 Sep 2021 07:54:09 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Message-ID: Organization: KPN B.V. Path: eternal-september.org!reader02.eternal-september.org!news.mixmin.net!feed.abavia.com!abe001.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail Injection-Date: Sat, 18 Sep 2021 07:54:10 +0200 Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com" Xref: reader02.eternal-september.org comp.lang.ada:62770 List-Id: Op 13-9-2021 om 19:08 schreef ldries46: > I have a set of constants that need a different name each for > readability. It may not be an array. > For instance: > C1 : constant record_item := ..... > C2 : constant record_item := ..... > C3 : constant record_item := ..... > C4 : constant record_item := ..... > C5 : constant record_item := ..... > > Now in a procedure or a function I have to use one of these constants > for instance: > > function X(C : record_item) return record_Item is >    RI : record_item; > begin >    .. >    .. >    RI := C -- This C may only be one of the five constants and not > another record_item >    .. >    .. >     return RI; > end X; > > In what way do I test if C is a constant and not another record Item In the meantime I have added a boolean to the record "record_item"in which true means this is a constant and false  this not a constant then in the function X  I raise an exception if that boolean if false