comp.lang.ada
 help / color / mirror / Atom feed
From: Jacob Sparre Andersen <jacob@jacob-sparre.dk>
Subject: Re: Making sense of predicates
Date: Wed, 23 Oct 2013 09:56:32 +0200
Date: 2013-10-23T09:56:32+02:00	[thread overview]
Message-ID: <87a9i0qv2n.fsf@adaheads.sparre-andersen.dk> (raw)
In-Reply-To: b4d93d01-c200-404f-a414-71258ef8318c@googlegroups.com

Shark8 wrote:

> On Tuesday, October 22, 2013 1:35:02 AM UTC-6, Jacob Sparre Andersen wrote:

>> package Parts is
>>    subtype Digit_Character is Character range '0' .. '9';
>>    subtype Part_Number is String
>>      with Dynamic_Predicate => (for all C of Part_Number
>>                                   => C in Digit_Character);
>> end Parts;
>
> I think you misunderstand my point: there's no real reason [at least
> that I can tell (apart from syntax, possibly)] that an array-type
> cannot be subtyped in order to place additional [static] constraint
> upon the base-type.

I've not tried to work out what differences there must be between how a
compiler implements dynamic and static predicates, but I assume that
there is a reason that the ARG decided to distinguish between the two
cases.

> IOW, why is the predicate required to be dynamic when, for example,
> "subtype Number_String is Array(Positive range <>) of Digit_Character"

That one isn't a subtype, which may hint at the reason.

> or "subtype short_String is String(1..255)" is not a
> dynamic-predicate?

A better example.  I'm not sure why, but I suspect that the
differentiation is due to how a compiler implements the checks.

If we can work out how to make the checks for some classes of
(currently) dynamic predicates as simple as those for static predicates,
we can probably get the ARG to reclassify those classes of predicates.

Greetings,

Jacob
-- 
"It ain't rocket science!"


  reply	other threads:[~2013-10-23  7:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-21 19:51 Making sense of predicates Dmitry A. Kazakov
2013-10-22  4:35 ` Randy Brukardt
2013-10-22  8:19   ` Dmitry A. Kazakov
2013-10-22 12:53     ` Georg Bauhaus
2013-10-22 13:38       ` Dmitry A. Kazakov
2013-10-22 20:38         ` Georg Bauhaus
2013-10-24  4:03     ` Randy Brukardt
2013-10-24  7:26       ` Dmitry A. Kazakov
2013-10-22  7:14 ` Shark8
2013-10-22  7:35   ` Jacob Sparre Andersen
2013-10-22 17:26     ` Shark8
2013-10-23  7:56       ` Jacob Sparre Andersen [this message]
2013-10-24  3:58       ` Randy Brukardt
2013-10-22  8:11   ` Dmitry A. Kazakov
2013-10-22  7:20 ` Jacob Sparre Andersen
2013-10-22  7:57   ` Dmitry A. Kazakov
2013-10-22 14:52     ` Dan'l Miller
2013-10-22 16:30       ` Dmitry A. Kazakov
2013-10-22 17:15         ` Dan'l Miller
2013-10-22 19:26           ` Dmitry A. Kazakov
2013-10-22 19:49             ` J-P. Rosen
2013-10-22 21:30             ` Dan'l Miller
2013-10-23  9:25               ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox