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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c1fe4bc1dd51fc87 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!s12g2000prg.googlegroups.com!not-for-mail From: Eric Hughes Newsgroups: comp.lang.ada Subject: Re: User-defined type attributes Date: Mon, 17 Mar 2008 14:58:54 -0700 (PDT) Organization: http://groups.google.com Message-ID: <0bed9b46-9b67-4b9c-b4c1-b8c27b60a356@s12g2000prg.googlegroups.com> References: <928f737d-955f-415b-93b1-ddbd24fbf81e@e25g2000prg.googlegroups.com> NNTP-Posting-Host: 166.70.57.218 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1205791135 11122 127.0.0.1 (17 Mar 2008 21:58:55 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 17 Mar 2008 21:58:55 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s12g2000prg.googlegroups.com; posting-host=166.70.57.218; posting-account=5RIiTwoAAACt_Eu87gmPAJMoMTeMz-rn User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20457 Date: 2008-03-17T14:58:54-07:00 List-Id: On Mar 17, 3:03 pm, "Randy Brukardt" wrote: > In cases like these, you have to pass accessor routines explicitly. Yeah, I figured that out this morning. I should know better to post at the end of the day before I've slept on it. > It gives a > default for the subprograms [...] (Why you can't have such defaults for types > is unknown by me...) Yeah, we just had that discussion two weeks ago. > I would prefer to use an interface or tagged type here, but obviously you > can't do that. This is not a perfect solution, but it works and is commonly > used. Notationally, it would be better, sure. The problem, as you acknowledge, is that it's a bad idea for a system library to require any particular inheritance in order to work. Working on this little project has given substance to an idea I've had for a while about non- inheritance type relationships. In brief, it's to give a name to the set of types that satisfy a certain set of signatures that, critically, need _not_ be sufficient to form an abstract type. This specification constitutes a partial type. To pick a simple example, the set of trichotomous types is that which have a total ordering that satisfy the standard trichotomy axioms (\forall a,b : a < b \land b < a \implies a = b). Trichotomy is a partial type. It's a natural parameter for generic ordered containers. Indeed, partial types are the natural kind of formal type parameter for any generic. Right now in Ada they have to be simulated by passing some set of formal parameters. The spirit of Ada would be better served by giving them an explicit representation. Eric