comp.lang.ada
 help / color / mirror / Atom feed
From: "Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr>
Subject: Re: Overloading attributes
Date: Sun, 27 Nov 2011 21:34:42 +0100
Date: 2011-11-27T21:34:42+01:00	[thread overview]
Message-ID: <op.v5mgr4x1ule2fv@douda-yannick> (raw)
In-Reply-To: jau4t6$7ms$1@speranza.aioe.org

Le Sun, 27 Nov 2011 21:00:39 +0100, <anon@att.net> a écrit:

> 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 ::=
>           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 only
> if this International Standard explicitly allows it, or for an
> implementation-defined attribute if the implementation allows it.  Each
> 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 states
> that it is up to the implementation to allow it if the Standard does not
> explicitly allows it.
>
> For instant, the implementation could say that the programmer can create
> new attributes for types created by the programmer only. Aka like the
> attribute "Image" (which is define for scalar objects), for a programmer
> defined record. Or the implementation could predefine a set of "attribute
> 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 Standards
> Ada 95, Ada 2005 and Ada 2012 they started to limit the usage, but still
> 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:
> […]
> * 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 the  
RM where it “explicitly permit” user defined attributes. At least, user  
defined attributes does not fall in the “impossible or impractical to  
avoid” case.

-- 
“Syntactic sugar causes cancer of the semi-colons.” [1]
“Structured Programming supports the law of the excluded muddle.” [1]
[1]: [Epigrams on Programming — Alan J. — P. Yale University]



  reply	other threads:[~2011-11-27 20:34 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-26 23:13 Overloading attributes Matt Borchers
2011-11-26 23:24 ` Shark8
2011-11-27  7:38   ` Yannick Duchêne (Hibou57)
2011-11-27  3:36 ` anon
2011-11-27  7:04   ` J-P. Rosen
2011-11-27 20:00     ` anon
2011-11-27 20:34       ` Yannick Duchêne (Hibou57) [this message]
2011-11-27 20:50         ` Yannick Duchêne (Hibou57)
2011-11-27 23:10       ` J-P. Rosen
2011-11-28  9:11         ` anon
2011-11-28 10:53           ` Peter C. Chapin
2011-11-29 11:58             ` anon
2011-11-29 12:50               ` Mark Lorenzen
2011-11-30 11:05                 ` anon
2011-11-29 16:16               ` AdaMagica
2011-11-29 17:43                 ` Jeffrey Carter
2011-11-29 23:26                 ` J-P. Rosen
2011-11-30 11:06                   ` anon
2011-11-30 15:52                     ` J-P. Rosen
2011-11-30 17:27                       ` Yannick Duchêne (Hibou57)
2011-11-30 20:45                       ` Pascal Obry
2011-12-01 11:01                       ` Simon Wright
2011-12-02 18:55                       ` anon
2011-12-02 19:34                         ` Ludovic Brenta
2011-12-02 20:02                           ` Yannick Duchêne (Hibou57)
2011-12-03  1:41                           ` Randy Brukardt
2011-11-28 12:06           ` Ludovic Brenta
2011-11-27  5:11 ` Yannick Duchêne (Hibou57)
2011-11-27 12:57 ` Dmitry A. Kazakov
replies disabled

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