comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Is there a way to see if a value is declared as a constant
Date: Mon, 13 Sep 2021 20:48:40 +0200	[thread overview]
Message-ID: <sho6ea$t51$1@dont-email.me> (raw)
In-Reply-To: <nnd$38993e8c$31c2bc63@28832d745e09e0f7>

On 9/13/21 7:08 PM, ldries46 wrote:
> 
> In what way do I test if C is a constant and not another record Item

function X (C : in Record_Item) return Record_Item with
    Pre => C = C1 or C = C2 or C = C3 or C = C4 or C = C5;

Of course, if you have a lot of constants with more descriptive names, the 
precondition will be hard to read. If you had a constant array it would be more 
readable:

Pre => (for some A of Allowed_Values => C = A);

-- 
Jeff Carter
"You've got the brain of a four-year-old boy,
and I bet he was glad to get rid of it."
Horse Feathers
47

  parent reply	other threads:[~2021-09-13 18:48 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 [this message]
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
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