comp.lang.ada
 help / color / mirror / Atom feed
From: Matt Borchers <mattborchers@gmail.com>
Subject: Re: Why doesn't Ada allow user-defined attributes?
Date: Thu, 20 Jul 2017 16:58:09 -0700 (PDT)
Date: 2017-07-20T16:58:09-07:00	[thread overview]
Message-ID: <285d9efd-f9c7-48e6-aa1b-a851f57d3693@googlegroups.com> (raw)
In-Reply-To: <f8aceb25-018f-4248-bc1b-d3a145108e93@googlegroups.com>

I don't think I ever thought of a great user defined attribute but I do recall 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 number 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 calling 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 seems unfortunate since it gives the user the ability to be inconsistent.  If this is not true, please let me know.

  parent reply	other threads:[~2017-07-20 23:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-20  0:02 Why doesn't Ada allow user-defined attributes? Shark8
2017-07-20  9:34 ` Brian Drummond
2017-07-20 16:07   ` Shark8
2017-07-21  4:46     ` Georg Bauhaus
2017-07-21  7:08       ` Dmitry A. Kazakov
2017-07-21 17:11         ` Georg Bauhaus
2017-07-21 19:39           ` Dmitry A. Kazakov
2017-07-22 16:33             ` G.B.
2017-07-22 20:12               ` Dmitry A. Kazakov
2017-07-23  6:41                 ` G.B.
2017-07-23  8:22                   ` Dmitry A. Kazakov
2017-07-24 17:52                     ` G.B.
2017-07-20 18:53 ` Randy Brukardt
2017-07-20 23:58 ` Matt Borchers [this message]
2017-07-21  7:14   ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox