comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: About 0Y interfaces
Date: Tue, 18 Oct 2005 18:54:46 +0200
Date: 2005-10-18T18:54:41+02:00	[thread overview]
Message-ID: <180gerbi90omf.pylfyvfq3l09.dlg@40tude.net> (raw)
In-Reply-To: 435507E0.7020401@mailinator.com

On Tue, 18 Oct 2005 16:34:08 +0200, Alex R. Mosteo wrote:

> Dmitry A. Kazakov wrote:
>> On Tue, 18 Oct 2005 14:49:04 +0200, Alex R. Mosteo wrote:
>> 
>>>I hope someone can clarify some aspects of interfaces to me. I've read 
>>>the description in several places but there are some things I'm not sure 
>>>about.
>>>
>>>Firstly, interfaces are purely abstract, right? There's no way to 
>>>provide a default/partial implementation except creating an object type 
>>>which implements that interface.
>>>
>>>Secondly, we can create an object type which implements two or more 
>>>interfaces. But I guess there's no multiple inheritance from classes, so 
>>>you couldn't use two implementations of two different interfaces 
>>>directly when creating a new type. Is this right? You'd need to use, for 
>>>example, member objects and use proxy calls.
>> 
>> I think the answer depends on what is meant under "implementation":
> 
> I was refering to implementation of the primitive operations.
> 
>> 1. Implementation of the values
>> (data implementation)
> 
> I'm not sure what this means. I'd say that you're not refering to data 
> initialization, since one can't provide record definition for an interface?

Yes

>> 2. Implementation of the primitive operations
>> (type interface implementation)
> 
> This is what I had in mind. Let's say for example that you want a 
> primitive operation to always make a dispatching call on another 
> operation. You can't model this in the interface, right?

Right. This is not how it works in Ada independently on interface/concrete
type issue. From a primitive operation you call another operation
*consistent* to the view (contract) of the caller. This view is fixed, and
already at the compile time you know the target.

In other words: implementations of a primitive operation are [by default]
defined in terms of their types. If you wanted to have an operation defined
in terms of the class, that should be a class-wide operation.

>> 3. Implementation of class-wide operations
>> (class interface implementation)
> 
> I don't see any issue here. Just provide the subprograms you consider 
> necessary taking classwide objects?

These can be implemented in terms of abstract primitive operations. I
presume it is allowed.

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



  reply	other threads:[~2005-10-18 16:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-18 12:49 About 0Y interfaces Alex R. Mosteo
2005-10-18 13:18 ` Dmitry A. Kazakov
2005-10-18 14:34   ` Alex R. Mosteo
2005-10-18 16:54     ` Dmitry A. Kazakov [this message]
2005-10-18 16:36 ` Pascal Obry
2005-10-18 22:01   ` Randy Brukardt
2005-10-19  9:08     ` Brian May
2005-10-19 21:51       ` Randy Brukardt
2005-10-20  6:44         ` Alex R. Mosteo
2005-10-19  9:11     ` Pascal Obry
replies disabled

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