From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a02:b53a:: with SMTP id l55-v6mr26793024jaj.8.1539196720254; Wed, 10 Oct 2018 11:38:40 -0700 (PDT) X-Received: by 2002:a9d:3434:: with SMTP id v49-v6mr267953otb.3.1539196720077; Wed, 10 Oct 2018 11:38:40 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.166.216.MISMATCH!x98-v6no79292ita.0!news-out.google.com!n199-v6ni154itn.0!nntp.google.com!z5-v6no79040ite.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 10 Oct 2018 11:38:39 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.18.64.97; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 76.18.64.97 References: <0f5608ef-0038-491c-b15f-f67bcc76fae8@googlegroups.com> <00285ebf-6ede-44da-848f-456930dc7475@googlegroups.com> <3620199a-f025-4099-83ad-a1e5042dc6c0@googlegroups.com> <8903c94f-efc7-4a2c-9513-ee17890b49d2@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <644dc84a-1e0c-4a1b-9672-38709acf1faa@googlegroups.com> Subject: Re: Record operations (Algebraic Data Types and printing) From: Shark8 Injection-Date: Wed, 10 Oct 2018 18:38:40 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:54536 Date: 2018-10-10T11:38:39-07:00 List-Id: On Wednesday, October 10, 2018 at 1:17:51 AM UTC-6, Dmitry A. Kazakov wrote= : > On 2018-10-10 00:20, Randy Brukardt wrote: > > "Lucretia" wrote in message > > news:fb2af9cb-5317-4f1c-867c-8876212d303b... >=20 > >> Like what 'Read/'Write/'Input/'Output do, they call a defined subprogr= am in > >> the package. Surely, it's not that hard. > >=20 > > What package? We're talking about (in part) the default representation = for a > > type. >=20 > What have T'Image and T'Value to do with the type representation? Well, T'Value would need two things: (1) to read from the stream, and (2) p= roduce the proper value of the type. This might require knowing the represe= ntation, such as a set of flags modeled by an "Array(1..8) of Boolean" [wit= h Size =3D> 8] being packed into a single byte. T'Image is related *only* in that it's supposed to be the inverse of T'Valu= e. >=20 > > Stream attributes use a complex concept called "availability" to deal > > with limited types, and they don't worry about privacy breakage at all. >=20 > Limited types should have no stream attributes at all. Same applied to=20 > 'Image/'Value. Returning limited object was a language design bug. This= =20 > cannot be fixed but it can be contained. I'm not sure about this. There's a good argument for it if you're (eg) mode= ling/interfacing into hardware... but there's argument against it if your p= urpose is merely controlling data. -- An example I could think of is some s= ort of keyed-index ownership-scheme where there's only one value of that pa= rticular type at a time, and some need for persistence across program runs.= (Wherein the values are saved to disk in program-shutdown, and restored in= program-start-up.) >=20 > > 'Value would need something similar at a minimum, and the question of > > privacy breakage also would have to be addressed (a package would not w= ant > > some outside force constructing values for its types; they might not me= et > > the [implied] invariants and other assumptions >=20 > [...] >=20 > Safe default is to generate publicly visible 'Image and 'Value=20 > propagating Use_Error for all types with private components. The package= =20 > provider could override them in the public part with bodies renaming the= =20 > private default implementations of which have full visibility. Or, we could just let the attributes [functionally] act as callbacks, albei= t statically rather than dynamically assigned. Thus you could invoke T'Imag= e for anything w/ the attribute and have a good compile/run (even if the de= fault provided by the compiler is USE_ERROR)... then add in an implementati= on, use "For T'Image Use ..." or " with Image =3D> ..." (perhaps in the pri= vate section) and compile/run it w/o having altered the public/visible inte= rfacing.