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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,81bb2ce65a3240c3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.234.38 with SMTP id ub6mr728819pbc.2.1336515742277; Tue, 08 May 2012 15:22:22 -0700 (PDT) MIME-Version: 1.0 Path: pr3ni3884pbb.0!nntp.google.com!news1.google.com!goblin3!goblin1!goblin.stu.neva.ru!news.tornevall.net!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: What would you like in Ada202X? Date: Tue, 8 May 2012 17:22:16 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <3637793.35.1335340026327.JavaMail.geo-discussion-forums@ynfi5> <20780405.1069.1336372385458.JavaMail.geo-discussion-forums@pbkc8> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1336515741 10592 69.95.181.76 (8 May 2012 22:22:21 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 8 May 2012 22:22:21 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2012-05-08T17:22:16-05:00 List-Id: "Niklas Holsti" wrote in message news:a0rsroFp8lU1@mid.individual.net... > On 12-05-08 03:48 , Randy Brukardt wrote: ... >> It seemed like a useful idea back in the day, > > I think that extending enumeration types by "deepening" is a different > idea than the AI95-261 "widening" idea. Don't you think that they are > logically different? The details are different, but the basic idea (adding more literals) is unchanged. And the use is in adding more literals, the details on exactly how you do that are much less important. >> but to be really useful, we >> need the equivalent of class-wide operations. > > That is the main question: do we? We need class-wide operations for Integer and Float and (especially) String, so it's hard to imagine how we could avoid needing them for such an enumeration! For example: Put (X : in Root_Integer'Class); is much more useable than a generic that you have to instantiation for each kind of type. (Some operations really do cross-cut types.) Inheritance of operations is virtually useless without class-wide operations. Note that class-wide operations don't necessarily have to involve dispatching, although that does seem like the most sensible model. Dmitry has pointed out repeatedly that one does not need to store tags with values of specific types; they can be added when converted to a class-wide type and that makes the most sense for elementary and array tagged types. >> I don't see how to do that if >> the position numbers are completely different between the various types. > > I agree. It seems to me that adding class-wide operations would force to > use some kind of tags, call by reference, and view conversions, and then > it becomes so similar to tagged types that it is not worth it. Umm, that's when it *does* become worth it. The problem is untagged types are pretty hard to use. (Note that I disagree about call-by-reference, but that's a detail.) > I think the idea of "deepened" enumeration types is worth pursuing only if > it is useful without class-wide operations. Then don't bother. IMHO, at least. > Another issue is that generic formal types of the "deepened" kind would be > needed. I think that would be the next point to work on for this proposal. We already have that. Generic derived types (with the ancestor being an enumeration) would provide the needed inheritance. But of course that better make semantic sense! Randy.