From mboxrd@z Thu Jan 1 00:00:00 1970 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada vs. Rust for low level system software Date: Wed, 13 Dec 2023 10:53:28 +0100 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 13 Dec 2023 09:53:29 -0000 (UTC) Injection-Info: dont-email.me; posting-host="103a7d2d41e48b7ed5b154aa9dd2d92e"; logging-data="128281"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18OBKk7gj9OLjIv0y1FoGjRhJU/coH4jw0=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:zRbaPmrZYIeCgNFYz0KHnRrZV6k= Content-Language: en-US In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:65914 List-Id: On 2023-12-13 10:10, Luke A. Guest wrote: > On 13/12/2023 08:27, Dmitry A. Kazakov wrote: >> Then of course Rust continues the worst practices tried by Ada and >> C++: templates/generics, macros. > > What's the alternative to generics? The question is what is the alternative to static/parametric polymorphism. The answer is dynamic polymorphism. 1. Dynamic polymorphism in Ada is as static as generics are. No run-time penalty unlikely to C++. 2. It covers cases generics do not, e.g. you can have class-wide run-time objects and proper class-wide subprograms. 3. It supports modular programming en large. E.g. you can put a class member in a dynamically linked library. 4. It is fully testable. Generics are fundamentally non-testable, only concrete instances are. 5. It is does not create a meta language layer with complexities for the compiler and programmer. Advanced generic code is close to unmaintainable. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de