Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > Re: User-define...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 11 of 23 Topic 5595 of 5931
Post > Topic >>

Re: User-defined type attributes

by "Randy Brukardt" <randy@[EMAIL PROTECTED] > Mar 13, 2008 at 08:46 PM

"Eric Hughes" <eric.eh9@[EMAIL PROTECTED]
> wrote in message
news:d9065e94-8586-4889-b5c7-a8ca9e8f2248@[EMAIL PROTECTED]
> First, a historical question: Was there a proposal for user attributes
> that was considered for Ada 2005?

Not seriously. It had been rejected for Ada 95, and in general, we didn't
want to rehash that old ground.

....
> And a related historical question: Why does the prefixed view of a
> subprogram only apply to tagged types?  It seems like a syntax
> eminently suited for any subprogram.

There are ambiguity problems because "any type" includes access types.
Recall that '.' in Ada always includes an implicit dereference (and the
prefixed notation also sup****ts the reverse, an implicit 'Access). That
is,
   A.B(C);
could mean
   B(A, C);
or
   B(A.all, C);
or
   B(A'access, C);

The latter should not be allowed for untagged types (they're not
implicitly
aliased). But, also it would be possible for it to mean
  B(A.all.all, C);
and
  B(A.all.all.all, C);
and so on forever.

That caused definitional and implementation problems. So we only allowed
tagged types.

That's OK, because only tagged types work "right" in Ada. There are a
number
of bizarre behaviors (one involves "=" of types with components, and
another
with the "reemergence" of predefined operations inside of a generic) that
had to be retained from Ada 83 for compatibility reasons. These language
mistakes are corrected with tagged types.

Thus, I think virtually all new composite types should be tagged in Ada
programs; you'll be a lot happier for it. Keep in mind that the only
runtime
overhead for a tagged object in Ada is the space for the tag and the time
to
fill it in on initialization; calls are statically bound unless you use
T'Class somewhere.

I usually go further and say all new types should be controlled (so as to
get user-defined finalization), but that does have a small runtime
overhead
if not used.

                               Randy.






> An attribute function must evaluate at compile-time, or perhaps more
> subtly, prior to elaboration time.  Much of the requisite apparatus is
> already present with static expressions and preelaborable packages.
> The standard would require an additional definition of the ability to
> pre-elaborate a function body.  While such a body might be restricted
> to returning a single static expression, that seem a bit restrictive.
>
> My overall motivation (as before) is to enable better, more flexible
> library sup****t.  Library sup****t gates usability and enables cost-
> justifiable selection of Ada in a greater number of application
> domains.  These kinds of features are not so critical for a single
> team writing their own software, but rather come into their own when
> writing libraries for other people to use in not-yet-anticipated ways.
>
> Eric
 




 23 Posts in Topic:
User-defined type attributes
Eric Hughes <eric.eh9@  2008-03-12 11:58:29 
Re: User-defined type attributes
"Dmitry A. Kazakov&q  2008-03-12 22:23:43 
Re: User-defined type attributes
Eric Hughes <eric.eh9@  2008-03-13 11:32:23 
Re: User-defined type attributes
"Dmitry A. Kazakov&q  2008-03-13 20:58:15 
Re: User-defined type attributes
"Randy Brukardt"  2008-03-13 20:46:41 
Re: User-defined type attributes
"Randy Brukardt"  2008-03-13 20:46:41 
Re: User-defined type attributes
"Randy Brukardt"  2008-03-13 20:46:41 
Re: User-defined type attributes
"Dmitry A. Kazakov&q  2008-03-14 10:00:46 
Re: User-defined type attributes
"Randy Brukardt"  2008-03-14 22:04:53 
Re: User-defined type attributes
"Dmitry A. Kazakov&q  2008-03-15 10:33:38 
Re: User-defined type attributes
"Randy Brukardt"  2008-03-13 20:46:37 
Re: User-defined type attributes
Eric Hughes <eric.eh9@  2008-03-13 20:55:27 
Re: User-defined type attributes
"Dmitry A. Kazakov&q  2008-03-14 10:01:47 
Re: User-defined type attributes
Eric Hughes <eric.eh9@  2008-03-13 21:41:21 
Re: User-defined type attributes
"Randy Brukardt"  2008-03-14 22:20:19 
Re: User-defined type attributes (replacing genericity)
Eric Hughes <eric.eh9@  2008-03-14 10:51:25 
Re: User-defined type attributes (replacing genericity)
"Dmitry A. Kazakov&q  2008-03-14 19:58:18 
Re: User-defined type attributes (replacing genericity)
"Randy Brukardt"  2008-03-14 23:01:56 
Re: User-defined type attributes
Eric Hughes <eric.eh9@  2008-03-14 11:04:33 
Re: User-defined type attributes (replacing genericity)
Eric Hughes <eric.eh9@  2008-03-14 13:19:47 
Re: User-defined type attributes
Eric Hughes <eric.eh9@  2008-03-16 21:38:37 
Re: User-defined type attributes
"Randy Brukardt"  2008-03-17 16:03:10 
Re: User-defined type attributes
Eric Hughes <eric.eh9@  2008-03-17 14:58:54 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Oct 16 0:57:06 CDT 2008.