comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Interfaces and abstract tagged types
Date: Sat, 25 Oct 2008 10:57:29 +0200
Date: 2008-10-25T10:57:28+02:00	[thread overview]
Message-ID: <6bum6osar2sr.18v0h7zintcn0.dlg@40tude.net> (raw)
In-Reply-To: 4ba8b27d-6228-4451-bfc6-ef19dd4b96cb@k13g2000hse.googlegroups.com

On Wed, 22 Oct 2008 23:39:10 -0700 (PDT), Ivan Levashew wrote:

>> The perversion is that inheritance as form of polymorphism is
>> technically
>> replaced by another form of (parametric polymorphism). What are
>> interfaces for, if generics must be used instead?
> 
> Interfaces are for run-time polymorphism, the final goal.
> Generics is just an aid to do it in a handy way.

Oh, certainly pulling a car with horses is an aid, but I prefer its
engine...
 
>> In order to handle this exponentially exploding code,
>> generics are
>> introduced down the tree. I.e. Bi becomes a generic and
>> interfaces are
>> passed as formal parameters of. Then the generic instances
>> are passed down
>> the tree to lower generics.
> 
> Right, it is supposed to be used this way. Maybe your complaints are
> due to lack of good UML tools for Ada 2005?

One meta language (generics) is far than enough to make it unmaintainable.
You suggest that yet another layer put on top the pile should help?

Anyway, I don't like the idea that Ada interfaces where introduced just in
order to support sells of UML tools... (:-))

>> The interface
>> cannot be inherited from a concrete type
> 
> I think this is obvious that Ada designer can't let you do this
> trick. A concrete type might have more primitive operation than
> interface you're want to declare.

This is a software design issue, not compiler's business. Do not inherit if
you prefer cut-and-paste.

> List and Vector have extra
> operations that can be done efficiently. How can Ada compiler be sure
> whether you'd like to treat Vector implementation as an implementation
> of hypothethic Vector_Interface or whether Vector is just an
> enumerable container. If it's really the case that every primitive
> operation must be copied to the interface, this fact must be stated
> explicitly.

I don't understand the problem. Clearly, when you inherit, you do
everything visible. Same happens when you inherit interface from interface,
why does not it bother you then?

There exist separate issues of disallowing operations and/or delegation.
Neither is possible in Ada, but these are unrelated to interfaces. 

----------
Basically, there should be no language concept "interface." It is
fundamentally wrong, because it reveals something about the implementation
(that no one shall exist).

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



      reply	other threads:[~2008-10-25  8:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-05  7:01 Interfaces and abstract tagged types Dale Stanbrough
2008-10-05  7:43 ` Dmitry A. Kazakov
2008-10-05 20:29   ` Robert A Duff
2008-10-06  8:25     ` Dmitry A. Kazakov
2008-10-16  7:51       ` Ivan Levashew
2008-10-16  8:29         ` Dmitry A. Kazakov
2008-10-16  9:23           ` Ivan Levashew
2008-10-16 10:05             ` Dmitry A. Kazakov
2008-10-16 10:27               ` Georg Bauhaus
2008-10-16 12:21                 ` Dmitry A. Kazakov
2008-10-16 13:35                   ` Georg Bauhaus
2008-10-16 14:30                     ` Dmitry A. Kazakov
2008-10-23  6:39                 ` Ivan Levashew
2008-10-25  8:57                   ` Dmitry A. Kazakov [this message]
replies disabled

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