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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.79.88 with SMTP id c85mr3240150itb.34.1500595090238; Thu, 20 Jul 2017 16:58:10 -0700 (PDT) X-Received: by 10.36.125.65 with SMTP id b62mr199937itc.5.1500595090210; Thu, 20 Jul 2017 16:58:10 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!t6no44591itb.0!news-out.google.com!f71ni200itc.0!nntp.google.com!t6no44161itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 20 Jul 2017 16:58:09 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=24.34.53.181; posting-account=1tLBmgoAAAAfy5sC3GUezzrpVNronPA- NNTP-Posting-Host: 24.34.53.181 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <285d9efd-f9c7-48e6-aa1b-a851f57d3693@googlegroups.com> Subject: Re: Why doesn't Ada allow user-defined attributes? From: Matt Borchers Injection-Date: Thu, 20 Jul 2017 23:58:10 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:47480 Date: 2017-07-20T16:58:09-07:00 List-Id: I don't think I ever thought of a great user defined attribute but I do rec= all wishing that some other attributes could be overloaded. For example, a= linked list implementation where 'First could be overloaded to return the = head pointer, 'Last to return the tail pointer, and 'Length to return the n= umber of elements in the list. These attributes are only usable on scalar = types and arrays so it would be mildly useful to use them in other contexts= . In reality, however, the attributes would just be another notation for c= alling the function that was defined to do the overload so it doesn't make = much sense. However, if the implementing function can be hidden so that the= only interface was the attributes, that would be better. I'm a little bit disappointed that when you do overload the 'Read, 'Write, = 'Input, and 'Output attributes on a tagged type that the functions have to = be visible in the package specification giving the user of the package the = option to use the attributes or just call the functions themselves. This s= eems unfortunate since it gives the user the ability to be inconsistent. I= f this is not true, please let me know.