From: Shark8 <onewingedshark@gmail.com>
Subject: Re: Is there a way to see if a value is declared as a constant
Date: Tue, 14 Sep 2021 16:47:21 -0700 (PDT) [thread overview]
Message-ID: <33ca979b-c486-44c9-a34d-871fdfe1d568n@googlegroups.com> (raw)
In-Reply-To: <nnd$38993e8c$31c2bc63@28832d745e09e0f7>
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;
next prev parent reply other threads:[~2021-09-14 23:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-13 17:08 Is there a way to see if a value is declared as a constant ldries46
2021-09-13 17:27 ` Björn Lundin
2021-09-13 18:48 ` Jeffrey R. Carter
2021-09-13 19:00 ` Dmitry A. Kazakov
2021-09-14 6:47 ` ldries46
2021-09-14 6:58 ` Emmanuel Briot
2021-09-14 23:47 ` Shark8 [this message]
2021-09-18 5:54 ` ldries46
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox