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!s37g2000prg.googlegroups.com!not-for-mail From: Eric Hughes Newsgroups: comp.lang.ada Subject: Re: User-defined type attributes Date: Thu, 13 Mar 2008 11:32:23 -0700 (PDT) Organization: http://groups.google.com Message-ID: <30f629fd-69d3-4d40-995f-9933f52b8dad@s37g2000prg.googlegroups.com> References: 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 1205433144 15648 127.0.0.1 (13 Mar 2008 18:32:24 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 13 Mar 2008 18:32:24 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s37g2000prg.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:20351 Date: 2008-03-13T11:32:23-07:00 List-Id: On Mar 12, 3:23 pm, "Dmitry A. Kazakov" wrote: > Attributes in Ada aren't necessarily static, even type's attributes aren't. > To me static functions is an independent, yet important issue. Most attributes are completely static. The ones that aren't (like T'Callable, E'Caller) seem all to be of a kind that (1) statically return a function (2) whose first parameter is the type of the object, and then (3) apply it to that object. Given that this is at least in the spirit of a preelaborable attribute, there's the possibility of treating these cases as syntactic shorthand: Obj'Attr for Obj'Attr( Obj ), or alternately for Obj.Obj'Attr. I did a brief scan of ARM05/Annex-K just now, and this applies to all the cases I found (which were all tasking or type attributes). So I'll modify my idea to deal with historical syntax: 1) The definition of an attribute function has a static expression. 2) The syntax for invoking an attribute may imply a dynamic function call. Such implicit calls generate a syntax ambiguity between "attribute procedure Op( X : T )" and "attribute procedure Op( X : T ; Y : T )" when invoking with only positional parameters. What would Obj'Op( Obj ) mean? I assume this can be adequately addressed. > In my view attributes should be primitive operations. I would handle them > similarly to prefix notation. I.e. X(Y,Z), Y.X(Z), Y'X(Z) considered > equivalent. The whole point of user attributes is to gain cleaner syntax for referring to the environment of a type or object, that which is available at pre-elaboration time, and supports generic programming better. Without such a syntax there are lots more formal parameters that need to be forwarded around. Just making attributes run-time functions eliminates a useful distinction. Functions on a type are part of the tradition algebraic specification of a type. Attributes on a type are part of the language environment inside of which a type specification is expressed. These are very different. > When applied to types, that should be treated just as a > parameter of the type Tag. That seems like the right way to treat the first parameter of an implicit function call for an attribute on a type. Eric