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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border1.nntp.dca1.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!news.stack.nl!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "G.B." Newsgroups: comp.lang.ada Subject: Re: A bad counterintuitive behaviour of Ada about OO Date: Mon, 11 Aug 2014 13:35:22 +0200 Organization: A noiseless patient Spider Message-ID: References: <932kntuq5rrr.8sumwibqrufn.dlg@40tude.net> <1ohy7vnbntskq$.h139ov04mlxu$.dlg@40tude.net> <536e35d6-f1de-4917-9300-26d78686eaf2@googlegroups.com> <1w3wuhu3d4nxi$.qluzbi0gtlxx$.dlg@40tude.net> <2extr7bydwfw.tcda12f9xnq9.dlg@40tude.net> <4a3996f3-666e-404a-ad8b-ff1832751787@googlegroups.com> <19297tmx9dt9q.1p2p4i0odtkyw.dlg@40tude.net> <2e3dyovp6wty.myprjpgzi2uy$.dlg@40tude.net> <6c67704a-d399-433d-bd8e-4566e79defaf@googlegroups.com> Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 11 Aug 2014 11:35:23 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="b96887e80893c84a90c3007226ca0d1c"; logging-data="25398"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18+31PmOn/TT+bPKm2/RsHjAaFJhEEwV3A=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <6c67704a-d399-433d-bd8e-4566e79defaf@googlegroups.com> Cancel-Lock: sha1:O4H85mrEnLqdejcQRzE6dU68Bik= Xref: number.nntp.dca.giganews.com comp.lang.ada:188362 Date: 2014-08-11T13:35:22+02:00 List-Id: On 11.08.14 09:58, Maciej Sobczak wrote: > procedure Use_Specific_Factory (F : in Specific_Factory) is > > SP : Specific_Product := F.Make_Product; > > begin > -- ... > end; > > And there is no way to make*both* work in Ada. You can get one or the other but not both. Is this a correct paraphrase? "To make this practically work in Ada, one has to write procedure Use_Specific_Factory (F : in Specific_Factory) is SP : Specific_Product := Specific_Product (F.Make_Product); begin -- ... end; "and watch for run-time dispatching." Where function Make_Product (Shop : access Factory) return Product'Class is abstract; can be overridden as a prim op of Factory. The variance becomes a property of its invocation context.