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!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Ada Successor Language Date: Wed, 27 Jun 2018 00:01:19 +0300 Organization: Tidorum Ltd Message-ID: References: <5e86db65-84b9-4b5b-9aea-427a658b5ae7@googlegroups.com> <878t7u1cfm.fsf@nightsong.com> <776f3645-ed0c-4118-9b4d-21660e3bba4b@googlegroups.com> <87602fbu2g.fsf@nightsong.com> <87po0mziqt.fsf@nightsong.com> <87fu1izfgs.fsf@nightsong.com> <878t75nwad.fsf@adaheads.home> <15b6f89f-997b-45ac-86b4-2e614bb624c2@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net f73cdhXajeiSsakAzY1VDQ2C6VZlTK3iUT9mXh8B673tKZhQrv Cancel-Lock: sha1:RPaD5aqTZgQ2zJYVhkbnfIJ2E44= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: <15b6f89f-997b-45ac-86b4-2e614bb624c2@googlegroups.com> Xref: reader02.eternal-september.org comp.lang.ada:53352 Date: 2018-06-27T00:01:19+03:00 List-Id: On 18-06-26 16:59 , Dan'l Miller wrote: > On Tuesday, June 26, 2018 at 2:44:26 AM UTC-5, Dmitry A. Kazakov > wrote: >> On 2018-06-25 18:21, Dan'l Miller wrote: >>> On Monday, June 25, 2018 at 10:19:15 AM UTC-5, Dmitry A. Kazakov >>> wrote: >>>> On 2018-06-25 16:44, J-P. Rosen wrote: >>>>> Le 25/06/2018 à 16:21, Dmitry A. Kazakov a écrit : >>>> >>>>>> Ada could allow T'Class for untagged T. T'Class would be an >>>>>> indefinite type with values consisting of the actual type's >>>>>> tag and its value. When T is by-value type, you pass >>>>>> T'Class to a subprogram as tag + value. When T is >>>>>> by-reference type, you pass tag + reference. >>>>>> >>>>>> Upon dispatch, you strip the tag from the value or >>>>>> reference before passing value/reference down. >>>>> >>>>> It was a requirement of Ada95 that OOP be strictly contained, >>>>> and that the same typing system as Ada83 be kept for those >>>>> who don't want OOP. >>>> >>>> Don't want OO, don't declare T'Class objects. Where is a >>>> problem? >>> >>> The problem is that you just proposed 'Class for non-OO >>> semantics. Your proposal violates the Principal of Least >>> Surprise. >> >> Remember, Ada is a strongly typed language, T'Class is not T, there >> is no way it could break or change anything in T. > > Quit putting non sequitur words in my mouth. I never said that it > would break anything in T. I said that it would break T'Class in > •some• situations of the untagged extended records, analogous to ways > that are known in C++ as slicing. Ada community wants one of C++'s > most-maligned problems where the compiler sometimes picks the wrong > strong typing? I'm far from competent in C++, but searching a little for "C++ slicing" suggests that the slicing problem has to do with non-virtual assignment operators which implicitly and silently convert a derived-type expression on the right hand side, to a parent type variable (reference) on the left hand side, discarding the components added in the derivation. As Ada does not let one define one's own assignment operators, and as class-wide types are understood as discriminated by the tag, I don't think Dmitry's suggestion for class-wide types rooted in untagged types would lead to the same problems as slicing in C++. Dan'l, could you explain more about the slicing-like problem you see in Dmitry's suggestion? -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .