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 10 of 23 Topic 5595 of 5922
Post > Topic >>

Re: User-defined type attributes

by "Dmitry A. Kazakov" <mailbox@[EMAIL PROTECTED] > Mar 15, 2008 at 10:33 AM

On Fri, 14 Mar 2008 22:04:53 -0500, Randy Brukardt wrote:

> Not if you need other generic parameters along with the type. And this
is a
> way to do mixins, which otherwise can't be done in Ada 95 because type
can't
> derive from a class-wide type:
> 
>    generic
>       type S is new T with private;
>    package Foo is
>       type New_S is new S with private;
>       procedure New_Operation (Op : in out New_S);
>    end Foo;
> 
> It's a nice way to add persistence, for instance. (Interfaces only allow
you
> to add, umm, interfaces, not code.)

Speaking of language enhancements proper multiple inheritance would be a
better way to do this.

But actually I would like to have "supertypes" in order to be able to add
interfaces and code to existing types:

   type T is ...;  -- Defined independently on Persistent

   type Persistent is abstract...; -- Oops, we forgot to do it before T

   type Bridge is new Persistent and old T; --- (:-))

Bridge is a subtype of Persistent and a supertype of T. This injects
Bridge's implementation of Persistent into T within Bridge's scope.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
 




 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 Mon Oct 6 16:54:46 CDT 2008.