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 14 of 23 Topic 5595 of 5881
Post > Topic >>

Re: User-defined type attributes

by Eric Hughes <eric.eh9@[EMAIL PROTECTED] > Mar 13, 2008 at 09:41 PM

On Mar 13, 7:46 pm, "Randy Brukardt" <ra...@[EMAIL PROTECTED]
> wrote:
[re: consideration of user attributes]
> Not seriously. It had been rejected for Ada 95, and in general, we
didn't
> want to rehash that old ground.

Hmm.  I do admit, unless you're specifically sup****t heavy generic
programming, it's not all that useful.

I wrote:
> > 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.
[...]
> That caused definitional and implementation problems. So we only allowed
> tagged types.

OK.  That's a can of worms.  I'm writing here, though, not to solve
that problem but to provide motivation about why a solution is
im****tant.

> That's OK, because only tagged types work "right" in Ada. [...]
>
> Thus, I think virtually all new composite types should be tagged in Ada
> programs [...]

I'm with you on the general idea.  In my own code, most of my types
are tagged.  But the requirement to have them tagged in order to use
the "." operator forces a trade-off: either (a) restrict generic
parameters to tagged types or (b) avoid "." notation and be required
to pull in whole packages rather than only single types.  This doesn't
match up with the separation of concerns (a.k.a. orthogonality) which
is one of the hallmarks of Ada and one of the things I appreciate most
about the language.  The power of generic programming is to
reinterpret the notation within a generic body through the parametric
meaning of that notation.  Today, for method invocations, that means
"call through the virtual function table".  That's certainly right for
tagged types.  It's too restrictive for other types.

My goal is to envision a reasonable way of introducing into visibility
all the affordances of a type with just the type name and not its
whole package of definition.  A hypothetical attribute such as
T'Package isn't the right thing, since it would expand visibility
(even if it were feasible to implement).

What about tagging the function rather than the type?  Imaginary
example:
    function Op( X : T ) return X is tagged ;
The sole purpose of the tag in this example is to mark a particular
function signature as available through "." notation.

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 Sun Sep 7 7:58:37 CDT 2008.