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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Ada Annoyances Date: Fri, 23 Jun 2017 11:25:37 +0100 Organization: A noiseless patient Spider Message-ID: References: <1ac5a44b-4423-443a-a7bb-2864d9abe78f@googlegroups.com> <1498048151.20885.28.camel@obry.net> <96174ea5-852d-44e9-8535-7c1eb24d5326@googlegroups.com> <98b98b8b-2f56-4d14-9989-3df51b08d97e@googlegroups.com> <04891954-77dd-49d1-84d6-d96f3befc0b0@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="2739a7595102635090014b065a52c7d0"; logging-data="31456"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19N3wmdZAMoPC9QMzbZYRU+BLZW0F4GxnU=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (darwin) Cancel-Lock: sha1:CJ+uyp4DsosO9u2TOMO3J9G8pHA= sha1:RhyX2yP0A0IzpQAASV0OVH+EA2E= Xref: news.eternal-september.org comp.lang.ada:47071 Date: 2017-06-23T11:25:37+01:00 List-Id: AdaMagica writes: > Am Donnerstag, 22. Juni 2017 23:52:42 UTC+2 schrieb Dmitry A. Kazakov: >> There is many ways to achieve the same [wrong] effect. E.g. without any >> dispatch: >> >> procedure Foo (P : Parent) is >> begin >> Bar (Some_Descendant_Of_Parent (P)); >> end Foo; >> > This code seems illegal to me, at least for tagged types: > 1. If Foo is a primitive operation, the body cannot know the descendants. > 2. The type conversion is illegal - here, an extension aggregate is needed. Illegal as-is because "downward conversion of tagged objects not allowed". procedure Foo (P : Parent) is begin Child (Parent'Class (P)).Bar; end Foo; will compile (and, presumably, work - but, ugh, unless you are sure there can't be a constraint error at the Child conversion, and even then ...)