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: Kevin Chadwick Newsgroups: comp.lang.ada Subject: Re: Best use cases for OOP (resent quoted sorry) Date: Thu, 28 Aug 2025 14:45:09 -0000 (UTC) Organization: A noiseless patient Spider Message-ID: <108pq1l$1dp6u$1@dont-email.me> References: <108pppp$1dmp6$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 28 Aug 2025 14:45:10 +0000 (UTC) Injection-Info: dont-email.me; posting-host="aed4e9b586c9bb7a612fda865bcca975"; logging-data="1500382"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18jvM5VCudaT848vElmXYhj1UVKnWGW4ek=" User-Agent: PhoNews/3.13.3 (Android/14) Cancel-Lock: sha1:RQnyBeIAr+7dFH0lTdUHWfze83w= In-Reply-To: <108pppp$1dmp6$1@dont-email.me> Xref: feeder.eternal-september.org comp.lang.ada:66976 List-Id: On 28/08/2025 15:40, Kevin Chadwick wrote: >On 28/08/2025 10:02, Dmitry A. Kazakov wrote: > >On 2025-08-28 10:50, Kevin Chadwick wrote: > >I can explain how it works. When a DLL is loaded its library level > >gets elaborated. So if you have: > >package P is > >   type T is tagged ... > >end P; > >in the main program or DLL and > >with P; > >package Q is > >   type S is new T with ... > >   function F return T'Class; > >end Q; > >in the DLL being loaded, then in the process of elaboration S will be > >created which in particular means extending of the dispatching table. > >You can return a class-wide object from there and dispatch on the > >newly created type's operation. > >Clear? > >Interesting, better than the shape examples but I guess you have to get > >that in the first instance. > >Dynamic polymorphism is an extremely powerful mechanism, but it kind of > >bends out of traditional typing. > >It is like the relativity theory. Everything is relative, position, > >velocity, but up to the point. Acceleration is not anymore. Same is with > >typing: value->type, so far so good, but one more step up: > >value->type->class and something happens. Primitive operations become > >reachable even if you do not see them, you cannot hide them. Multiple > >inheritance, OK, but what about conflicts, is it additive or idempotent? > >Multiple dispatch is a total dark hole. > > I have struggled to find compelling reasons to use tagged types considering they affect the size of records and potentially elaboration issues that cannot exist without tagged types. I know some use tagged types just for dot notation but that doesn't really move the needle in my mind. I would certainly appreciate it if people could share their favourite use cases for tagged types though. Things that are perhaps a pain without them or were with Ada 83. -- Regards, Kc