comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Re: Musing on defining attributes and the ability to define an "abstract type X"-interface.
Date: Thu, 3 Aug 2017 20:05:10 -0700 (PDT)
Date: 2017-08-03T20:05:10-07:00	[thread overview]
Message-ID: <ae46a44e-ee1e-42f6-ae8d-a02ae012e31d@googlegroups.com> (raw)
In-Reply-To: <87h8y67trd.fsf@jacob-sparre.dk>

On Thursday, July 20, 2017 at 2:12:08 PM UTC-6, Jacob Sparre Andersen wrote:
> Shark8 wrote:
> 
> > No, an array of ASCII is *NO* compatible with an array of Latin-1; the
> > first is 7-bit data, the latter is 8-bit data.
> 
> Depends on whether you worry about encoding or just consider ASCII and
> Latin-1 as character sets.  If you're just thinking of character sets,
> consider:
> 
>    subtype Latin_1_String is Wide_Wide_String
>      with Dynamic_Predicate => (for all C of Latin_1_String => Character'Val (C) < 256);
> 
>    subtype ASCII_String is Latin_1_String
>      with Dynamic_Predicate => (for all C of ASCII_String => Character'Val (C) < 128);

This has the implicit idea of a super-set [in this case Latin-1] which is fine, until you get into the representation territory. [Representation isn't /quite/ the same thing as encoding.]

To illustrate, a proper and strict ASCII string would be:
    Type ASCII_Character is Character range Character'First..Character'Pred( Character'Pos(128) );
    Type ASCII_String is Array(Positive Range <>) of ASCII_Character
     with Component_Size => 7, Packed;


But this isn't *REALLY* about strings in and of itself, that's just where it becomes most obvious, it's rather about being able to:
 (a) turn the current implicit hierarchy into an explicit one,
 (b) in a manner that will allow user the usage,
 (c) especially in the area of uniformity, and
 (d) also permits the [re]definition of our current
     language type-classes/-kinds/-classifications.

IOW, what I want to do is leverage the language's underlying concepts, making them explicit, and using *THAT* to unify/define what is already (in some sense) required... like how universal_integer attributes require a bignum package, but the language doesn't require its exposure.




  reply	other threads:[~2017-08-04  3:05 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-20  0:06 Musing on defining attributes and the ability to define an "abstract type X"-interface Shark8
2017-07-20  7:52 ` Dmitry A. Kazakov
2017-07-20 16:37   ` Shark8
2017-07-20 17:40     ` Dmitry A. Kazakov
2017-07-20 20:12     ` Jacob Sparre Andersen
2017-08-04  3:05       ` Shark8 [this message]
2017-08-04  6:48         ` Simon Wright
2017-08-04  7:10         ` Dmitry A. Kazakov
2017-08-05  0:17         ` Randy Brukardt
2017-08-05  6:25           ` Dmitry A. Kazakov
2017-08-05 16:51           ` Shark8
2017-08-05 17:18             ` Dmitry A. Kazakov
2017-08-05 21:29               ` Shark8
2017-08-06  7:04                 ` Dmitry A. Kazakov
2017-08-07 23:06                 ` Randy Brukardt
2017-08-08 17:28                   ` Shark8
2017-08-09  1:12                     ` Randy Brukardt
2017-08-09 18:17                     ` G.B.
2017-08-07 23:12             ` Randy Brukardt
2017-08-08  8:10               ` Dmitry A. Kazakov
2017-08-09  0:44                 ` Randy Brukardt
2017-08-09  6:55                   ` Dmitry A. Kazakov
2017-08-09 23:22                     ` Randy Brukardt
2017-08-10  7:02                       ` Dmitry A. Kazakov
2017-08-11  0:40                         ` Randy Brukardt
replies disabled

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