From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,XPRIO autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: calling function but ignoring results Date: Fri, 9 Jul 2021 21:57:27 -0500 Organization: JSA Research & Innovation Message-ID: References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com> Injection-Date: Sat, 10 Jul 2021 02:57:28 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="12949"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:62369 List-Id: "Niklas Holsti" wrote in message news:ikrlspFjskkU1@mid.individual.net... ... >> Is this "type-less" naming a copy of the popular omission schemes >> like auto in C++? Optional type annotations in Swift, or Scala? > > > I don't know all the origins of this language change, but it can be seen > as a correction because it avoids the wart in the earlier Ada form of > renaming, where a (sub)type name is included. The wart is that the > constraints of that (sub)type are essentially ignored, and so can be > misleading. Right; the name of the type is often a lie vis-a-vis the subtype properties; moreover, it is often the case that the type is included in the renamed item: Foo : renames Some_Type'(Bar(Obj)); Repeating the type in such cases is not useful and violates DRY ("Do Not Repeat Yourself"): Foo : Some_Type renames Some_Type'(Bar(Obj)); We felt this was something that was better handled by style guides rather than imposing unnecessarily wordy syntax. > AI12-0275 seems to be the main origin of this change: > > http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai12s/ai12-0275-1.txt?rev=1.9&raw=N The actual motivation behind this change was a strong desire for a shorter way to write bindings in declare expressions. We tried a number of things, but they all seemed oddly special case. Eventually, we settled on using normal syntax throughout declare expressions, but simplified the syntax for renaming in all cases. The tipping point was noticing the duplication in examples like the above, along with the fact that the subtype given is ignored anyway. If we were designing Ada from scratch, the subtype in a renames would have to statically match the nominal subtype of the name being renamed. But that wasn't required in Ada 83 and it would be way too incompatible to require now. (The reason that Ada 83 didn't require it? Jean Ichbiah didn't want to have to define "static matching" -- according to an old thread that John Goodenough dug up. Of course the Ada 9x team decided such a concept was necessary and added it to the language, so we ended up with most constructs using static matching, but renames being different.) Randy.