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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a6b:9651:: with SMTP id y78-v6mr5724913iod.106.1529358663336; Mon, 18 Jun 2018 14:51:03 -0700 (PDT) X-Received: by 2002:a9d:4b04:: with SMTP id q4-v6mr606348otf.3.1529358663253; Mon, 18 Jun 2018 14:51:03 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!news.redatomik.org!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!85.12.16.68.MISMATCH!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!u78-v6no5187013itb.0!news-out.google.com!c20-v6ni3501itc.0!nntp.google.com!u78-v6no5187010itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 18 Jun 2018 14:51:03 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=76.113.16.86; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 76.113.16.86 References: <5e86db65-84b9-4b5b-9aea-427a658b5ae7@googlegroups.com> <878t7u1cfm.fsf@nightsong.com> <776f3645-ed0c-4118-9b4d-21660e3bba4b@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Ada Successor Language From: Shark8 Injection-Date: Mon, 18 Jun 2018 21:51:03 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3441 X-Received-Body-CRC: 1927566656 Xref: reader02.eternal-september.org comp.lang.ada:53148 Date: 2018-06-18T14:51:03-07:00 List-Id: On Monday, June 18, 2018 at 3:27:13 PM UTC-6, ric....@gmail.com wrote: > On Monday, June 18, 2018 at 5:20:32 PM UTC-4, Shark8 wrote: >=20 > > I'd honestly like the ability to use X'Type; this would allow us to say= something like this: > >=20 > > [snip] > >=20 > > Yeah, I know, it's a little thing and you can do it with generics, etc.= But that's not entirely the point, the point is that this allows the decla= ration of types dependent on objects... it provides some of the niceties of= type-inference without having to resort to such lazy/possibly-error-prone = methodologies. >=20 >=20 > Why would you want that? You have to have visibility to the type to decla= re an object of the type. In your above example, you explicitly know about = Some_Type, and you also explicitly know that A and B are of that type. So y= ou don't need to query the parameter, since it is implicit. >=20 > Your example above has no purpose. Unless you're rapid-prototyping. > > Procedure Swap( A, B : in out Some_Other_Type ) is > > Temp : Constant B'Type :=3D B; > > Begin > > B:=3D A; > > A:=3D Temp; > > End Swap; One change in the above, no change-cascades into the body. This is precisely why text is such a bad format to think of as "natural" fo= r the 'source' -- it's not -- what we really have here problem-wise stated = in plain language is: "Given some type, and two names referring to them, sw= itch which names belong to which object." But that brings up something else that would be nice, the ability to do a s= wap like so: (a, b) :=3D (b, a); > Any other case where you wouldn't know about the type until runtime is ex= actly what generics are for. Generics in Ada are statically known at compile-time, just as the given exa= mple.