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-91-241.ec2.internal X-Spam-Level: * X-Spam-Status: No, score=1.0 required=3.0 tests=XPRIO autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: renaming as classwide type Date: Tue, 26 Sep 2023 00:46:07 -0500 Organization: A noiseless patient Spider Message-ID: References: <99e103fa-53c3-43b0-8a4f-686ca10424cdn@googlegroups.com> <5ab7e1d5-1491-49c3-877d-32bb6e12b43an@googlegroups.com> Injection-Date: Tue, 26 Sep 2023 05:45:43 -0000 (UTC) Injection-Info: dont-email.me; posting-host="f0a5cbfd923c9b47a54100ea42585311"; logging-data="2499760"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX198+KxU8E8ZF4UIcwIMx7P8vS2qTpy0zUI=" Cancel-Lock: sha1:TsTjDSutBBhvzH/DspIQCWbAzCM= X-Priority: 3 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 Xref: news.eternal-september.org comp.lang.ada:65724 List-Id: It's not needless; there is an implicit conversion on an assignment, and it only needs to work one way. When you rename a variable, the conversion has to work both ways. But that's problematic, since conversions often involve checks and we don't want checks popping up in unexpected places (both for implementation reasons and for readability reasons). Also, renaming does not change the nominal subtype of an object, regardless of what subtype is given in the renames. Ada 2022 allows you to omit the type name altogether since it provides little value. Randy. "Simon Belmont" wrote in message news:5ab7e1d5-1491-49c3-877d-32bb6e12b43an@googlegroups.com... On Thursday, September 21, 2023 at 5:03:06?PM UTC-4, G.B. wrote: > O does not denote an object of a class-wide type, > I think. However, P'Class (o) does, so that renaming > that would make r be of its declared type P'Class. That seems needlessly pedantic, considering that assignment is fine (o2 : P'Class := o) as well as assigning it to an intermediate pointer (po : access P'Class := o'Access; r : P'Class renames po.all)