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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada Successor Language Date: Fri, 29 Jun 2018 09:29:31 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <5e86db65-84b9-4b5b-9aea-427a658b5ae7@googlegroups.com> <878t75nwad.fsf@adaheads.home> <15b6f89f-997b-45ac-86b4-2e614bb624c2@googlegroups.com> <28a46046-e7eb-4306-bc39-72bc751831ae@googlegroups.com> <400ba7f8-6875-4ba8-99ee-c105180d5d8b@googlegroups.com> <87tvpm1e2q.fsf@nightsong.com> <39b42dbe-0e74-4855-9291-bbf5a193c3b4@googlegroups.com> <87lgay1cec.fsf@nightsong.com> NNTP-Posting-Host: MyFhHs417jM9AgzRpXn7yg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 X-Notice: Filtered by postfilter v. 0.8.3 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:53424 Date: 2018-06-29T09:29:31+02:00 List-Id: On 2018-06-29 05:48, Paul Rubin wrote: > Because of that same FP indoctrination, in C++ I tend to use generics > where it might be possible to use OO instead. Does that avoid the > hazards of slicing? That depends on how you use generics. If the language has this or any other problem, then in most cases, you can reconstruct it using generic instances. Simply put the offending code in a generic and here you are. If you mean specifically inheritance, then generics are not capable of it. There is no generic equivalent of, because each generic instance creates isolated types. Surely, you can use formal parameters like: generic type S is new T with private; but that is inheritance the generic borrows from outside, not a generic mechanism by itself. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de