TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Classic View

Use Proportional Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Randy Brukardt <[log in to unmask]>
Tue, 1 Dec 1998 14:44:35 -0600
text/plain (42 lines)
>I would like an answer to the following as to why it wasn't considered for
>addition to the Ada standard:
>
>Why didn't user-defined attribute functions (not 'Read and 'Write) get
>incorporated into the standard.

>Example:
>  type An_Integer is range 0 .. 100;
>  function An_Integer'New_Stuff (A : in Integer) return An_Integer;

>Usage:
>  A : An_Integer;
>  B : An_Integer := An_Integer'New_Stuff (A);

>Well you get the gist.....

This was considered for Ada 95; it was in the earliest drafts.

Implementors (well, me :) pointed out that this was quite expensive
to add to existing Ada 83 compilers. Most Ada 83 compilers (and I
suspect most Ada 95 compilers as well) handle attributes with special
case code - something like "if id = "First" then - implement 'First.

Therefore adding user-defined attributes requires new resolution
code, and new symbol table code. There also was a need to
describe what happened when a user-defined attribute collided
with a language defined attribute like "First" that is not a function.

All of the this made the implementation reasonably complex.

All proposed Ada 95 features underwent a cost-benefit analysis,
and the cost of this feature was relatively high, and benefit was
relatively low, so it was deleted.

Tucker's team managed to resurrect some of the lower cost
features that were cut this way (such as 'Unchecked_Access
and library level renames), but of course everyone's good
ideas couldn't be included.

                        Randy Brukardt
                        Ada 9x Distiguished Reviewer

ATOM RSS1 RSS2