From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Best use cases for OOP (resent quoted sorry)
Date: Fri, 29 Aug 2025 12:37:24 +0200 [thread overview]
Message-ID: <108rvt4$1trr3$1@dont-email.me> (raw)
In-Reply-To: <108rr1b$1t1hg$1@dont-email.me>
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"
<rant on>
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.
<rant off>
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
prev parent reply other threads:[~2025-08-29 10:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-28 14:40 Best use cases for OOP Kevin Chadwick
2025-08-28 14:45 ` Best use cases for OOP (resent quoted sorry) Kevin Chadwick
2025-08-28 15:12 ` Dmitry A. Kazakov
2025-08-28 18:28 ` Niklas Holsti
2025-08-28 20:23 ` Alex // nytpu
2025-08-29 8:28 ` Dmitry A. Kazakov
2025-08-29 9:14 ` Kevin Chadwick
2025-08-29 10:37 ` Dmitry A. Kazakov [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox