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: Mon, 25 Aug 2025 10:19:50 +0200 Organization: A noiseless patient Spider Message-ID: <108h6b7$3a75k$3@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> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 25 Aug 2025 08:19:52 +0000 (UTC) Injection-Info: dont-email.me; posting-host="83346f1a4a3a4ac997eb0857b159dfbd"; logging-data="3480756"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19wrZVj0wnLWUE2lKVas4dRCpzXBuxZAQg=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:DmQ26XXr+k4EPf7HEFpYi+R3XaY= In-Reply-To: <108g1fv$32gqg$3@dont-email.me> Content-Language: en-US Xref: feeder.eternal-september.org comp.lang.ada:66915 List-Id: On 2025-08-24 23:50, Lawrence D’Oliveiro wrote: > On Sun, 24 Aug 2025 10:37:53 +0200, Dmitry A. Kazakov wrote: > >> Well, I maintain Ada Python bindings. When I looked at Python "derived" >> types in its API, I was astounded by a total lack of inheritance. > > Don’t know what you mean. https://docs.python.org/3/c-api/type.html PyType_FromSpec etc. > Python not only has inheritance, it has full > multiple inheritance with C3 linearization. No members are inherited. E.g. in Ada type T is tagged record M : Integer; end record; type S is new T with record -- S is derived from T N : Float; end record; declare X : S; begin X.M := 1; -- M is inherited https://stackoverflow.com/questions/10064688/cant-access-parent-member-variable-in-python Not to say that nothing is checked etc. Expecting that from an untyped language would be silly anyway. But in OO it is incorrect to inherit covariant methods with arguments in the out or in-out mode, for example methods returning the type from the class: function Covariant return T; This would be broken for obvious reasons. So in a properly typed OO language, like Ada, you will be required to override Covariant upon derivation from T: overriding function Covariant return S; > It also has metaclasses. > Because classes, like functions, are first-class objects. A useless thing in an untyped language and in general one should first question what could be the purpose of a set of a set of types? Provided one could implement that thing (let's ignore pitiful Python), What algorithmic problems one could solve with that? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de