From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on ip-172-31-91-241.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.0 required=3.0 tests=none autolearn=unavailable autolearn_force=no version=4.0.1 Path: nntp.eternal-september.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: In precision typing we trust Date: Thu, 28 Aug 2025 09:54:11 +0200 Organization: A noiseless patient Spider Message-ID: <108p1v3$16qn1$1@dont-email.me> References: <107uv9g$3019a$1@dont-email.me> <107v1ji$303of$1@dont-email.me> <336fbb5f-a279-ea8e-67fd-f62bb00d6a89@irrt.De> <107vfb9$34cpj$1@dont-email.me> <10855lq$gj8l$1@dont-email.me> <1088h1a$19635$1@dont-email.me> <1089p1i$1ig1d$1@dont-email.me> <108aq2p$1qo9o$1@dont-email.me> <108dh2l$2f5h3$1@dont-email.me> <108ej11$2mbr8$1@dont-email.me> <108g1fv$32gqg$3@dont-email.me> <108h6b7$3a75k$3@dont-email.me> <87plcjn5ru.fsf@nightsong.com> <108hek3$3c6u1$1@dont-email.me> <87ldn7mil5.fsf@nightsong.com> <108ift9$3kh0r$1@dont-email.me> <108ijl2$3lihe$5@dont-email.me> <108jphl$3ti12$1@dont-email.me> <108liii$br9n$3@dont-email.me> <108mcoe$gv59$1@dont-email.me> <108o396$vok4$6@dont-email.me> <108o5hu$10c60$1@dont-email.me> <108o883$10pj9$4@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 28 Aug 2025 07:54:11 +0000 (UTC) Injection-Info: dont-email.me; posting-host="6f970729dc22bef6d204ec8c3c6ab955"; logging-data="1272545"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/b6env4Msp6lKwjsPrXd54NwPYPch3t4Q=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:QW0Sc6HqY9vEifj/FUuIlPtr23s= In-Reply-To: <108o883$10pj9$4@dont-email.me> Content-Language: en-US Xref: feeder.eternal-september.org comp.lang.ada:66960 List-Id: On 2025-08-28 02:35, Lawrence D’Oliveiro wrote: > On Thu, 28 Aug 2025 01:49:18 +0200, Dmitry A. Kazakov wrote: > >> On 2025-08-28 01:10, Lawrence D’Oliveiro wrote: >> >>> So I can do something like >>> >>> function F ... is declare >>> type T is ... >>> begin >>> ... >>> return T; >>> end; >>> >>> in Ada? >> >> No, you cannot spell such a function. Ada is a typed language: > > But I thought you said “In Ada types can be created dynamically”? So it > turns out that’s wrong? Because I can do that in Python. You cannot refer to a type before you created it, except specific cases of incomplete declarations. In Python you cannot do that either. What you can in Python is to declare a function that returns nobody knows what, because Python is untyped. > So you can’t actually show us any example of such a feature, to prove it > exists? Too bad ... I can explain how it works. When a DLL is loaded its library level gets elaborated. So if you have: package P is type T is tagged ... end P; in the main program or DLL and with P; package Q is type S is new T with ... function F return T'Class; end Q; in the DLL being loaded, then in the process of elaboration S will be created which in particular means extending of the dispatching table. You can return a class-wide object from there and dispatch on the newly created type's operation. Clear? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de