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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9544fb5ce0a6df8b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Received: by 10.68.28.135 with SMTP id b7mr21956539pbh.8.1322426084318; Sun, 27 Nov 2011 12:34:44 -0800 (PST) Path: lh20ni25342pbb.0!nntp.google.com!news1.google.com!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Overloading attributes Date: Sun, 27 Nov 2011 21:34:42 +0100 Organization: Ada @ Home Message-ID: References: <8ed87fee-166a-4be9-ae6c-4d0fbeb4788c@s6g2000vbc.googlegroups.com> NNTP-Posting-Host: B0fj88Qo5RPyajGtdWC/cQ.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/11.60 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: news1.google.com comp.lang.ada:19201 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2011-11-27T21:34:42+01:00 List-Id: Le Sun, 27 Nov 2011 21:00:39 +0100, a =C3=A9crit: > From time to time this forum has discussed the concept of the > "attribute definition clause" (Representation Attributes). Some have > even say it would cause an increase of 4_000 lines of code to be > written to include this feature in a compiler. > > > From Ada 95 RM > > 13.3 Representation Attributes > > 2 attribute_definition_clause ::=3D > for local_name'attribute_designator use expression; > | for local_name'attribute_designator use name; > > > Legality Rules > > 5 (95) > 5/1 (2005) > > An attribute_designator is allowed in an attribute_definition_clause o= nly > if this International Standard explicitly allows it, or for an > implementation-defined attribute if the implementation allows it. Eac= h > specifiable attribute constitutes an aspect of representation. You should have clearly marked where the quotation starts and where it = ends. Actually, it ends here, and all of the following, is your personal= = wordings, not part at all of the standard. > This clause does not forbid the creation of new attribute it only stat= es > that it is up to the implementation to allow it if the Standard does n= ot > explicitly allows it. > > For instant, the implementation could say that the programmer can crea= te > new attributes for types created by the programmer only. Aka like the > attribute "Image" (which is define for scalar objects), for a programm= er > defined record. Or the implementation could predefine a set of "attrib= ute > designators" that could be used by a programmer. > > > And for Ada 83, the complete syntax and implementation of must be > documented in Appendix F for the allowed representation clauses. > > So, Ada 83 allows the creation with just documentation. As for Standar= ds > Ada 95, Ada 2005 and Ada 2012 they started to limit the usage, but sti= ll > allow with the implementation permission. > > Which means that Ada can allow a programmer to create "Representation > Attributes" aka "Attributes" with some limitations if the Standard > or the Implementation allows it. You could go far this way, even up to an Ada compiler understanding MS = Quick Basic. Unfortunately for you, the standard also clearly state this= : > 1.1.3 Conformity of an Implementation with the Standard > Implementation Requirements > A conforming implementation shall: > [=E2=80=A6] > * Contain no variations except those explicitly permitted by this = > International Standard, > or those that are impossible or impractical to avoid given the = > implementation's > execution environment; So you can forget about user defined attributes, unless you can quote th= e = RM where it =E2=80=9Cexplicitly permit=E2=80=9D user defined attributes.= At least, user = defined attributes does not fall in the =E2=80=9Cimpossible or impractic= al to = avoid=E2=80=9D case. -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: [Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univer= sity]