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=0.0 required=3.0 tests=BAYES_40,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a37:a51:: with SMTP id 78mr7471648qkk.88.1631663242196; Tue, 14 Sep 2021 16:47:22 -0700 (PDT) X-Received: by 2002:a5b:b04:: with SMTP id z4mr2021435ybp.457.1631663241892; Tue, 14 Sep 2021 16:47:21 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 14 Sep 2021 16:47:21 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.231 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <33ca979b-c486-44c9-a34d-871fdfe1d568n@googlegroups.com> Subject: Re: Is there a way to see if a value is declared as a constant From: Shark8 Injection-Date: Tue, 14 Sep 2021 23:47:22 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:62738 List-Id: When you start fighting the language, it's usually an indicator that your design needs changing. Try using the things Ada does (e.g. types) to model your problem-space. Package Example is Type Whatever is private; I, J, K : Constant Whatever; Private Type Whatever is new Integer; Type Constants is Array (Positive range <>) of Whatever with Dynamic_Predicate => (for all Index_1 in Constants'First..Natural'Pred(Constants'Last) => (for all Index_2 in Positive'Succ(Index_1)..Constants'Last => Constants(Index_1) /= Constants(Index_2) ) ); Constant_Store : Constant Constants:= (1,7,3,11,77,2,7); I : Constant Whatever:= Constant_Store(4); J : Constant Whatever:= Constant_Store(2); K : Constant Whatever:= Constant_Store(5); End Example;