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: Best use cases for OOP (resent quoted sorry) Date: Fri, 29 Aug 2025 12:37:24 +0200 Organization: A noiseless patient Spider Message-ID: <108rvt4$1trr3$1@dont-email.me> References: <108pppp$1dmp6$1@dont-email.me> <108pq1l$1dp6u$1@dont-email.me> <108qdsu$1j3g1$1@dont-email.me> <108rob8$1rkon$4@dont-email.me> <108rr1b$1t1hg$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 29 Aug 2025 10:37:24 +0000 (UTC) Injection-Info: dont-email.me; posting-host="2875a737d4341ace9c98c50ea5ed6746"; logging-data="2027363"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18avG0Q9qaAD35NHPzHwTXQ4w6jCQkTv34=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:4pY6Y5XtPuxz6lqri2SWEcJVEFk= In-Reply-To: <108rr1b$1t1hg$1@dont-email.me> Content-Language: en-US Xref: feeder.eternal-september.org comp.lang.ada:66994 List-Id: On 2025-08-29 11:14, Kevin Chadwick wrote: > >> One language extension I always wanted were an ability to have classes >> of types without having a tag embedded in the representation. > > I understand the usability problems tags can cause but not sure I > understand > the benefit. Would it allow memory mapped registers such as Timer_1 and > Timer_2 with some differences but whose shared components could be handled > by a procedure accepting 'Class even though those shared components were > memory mapped to different locations. Your Timer_1 and Timer_2 are limited types, so you cannot have a class of them without burying a tag into. Since you cannot copy such things you cannot convert Timer_1 to Timer'Class per view. Unless you allow copy-in copy-out semantics. > If so I would love that. Even if it > would not enable that. Have you considered making a suggestion here? > > "https://github.com/Ada-Rapporteur-Group/User-Community-Input/issues" No, because such changes are never accepted. One thing is to introduce square brackets and break separation of interface and implementation (all these bodies of functions in declarations, if-/case-/for-expressions etc) and another thing is a serious overhaul of the type system such as it was done in Ada 95. Note that it is more than just handling external tags. It is a general principle of a type constraint. Tag is a constraint of T'Class. So are array bounds. So is dimension in the AdaCore hack of dimensioned types. All these should have been discriminants. And all discriminants should have been handled like array bounds are handled. That is when you declare a constrained array String (1..80), the bounds are not there. When you make it unconstrained (convert to String) the bounds are added (e.g. passed around). Now compare that with a record discriminant, with a type tag in T <-> T'Class etc. Though it would be quite possible to make this backward compatible, any proposal will be dismissed on the ground of "breaking" the language. People think they hate OO, consider yourself. But it reality they hate any type system which is an inch more powerful than C. A miniscule minority could gritting the teeth accept Ada 83. But this is where the train stops. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de