Re: [fpc-pascal] Inherit interface from 2 interfaces

2011-04-13 Thread Zaher Dirkey
On Tue, Apr 12, 2011 at 11:42 AM, michael.vancann...@wisa.be wrote:



 On Tue, 12 Apr 2011, Andreas Dorn wrote:

  On Fri, 8 Apr 2011,michael.vancanneyt worte:

 The whole idea of interfaces is to avoid multiple inheritance.

  Hm. I don't believe that.

 One of the major points of interfaces is indeed to avoid the problems
 of multiple class inheritance (diamond problems - i.e. problems caused by
 conflicting implementations of a method in different ancestor classes).

 But Interfaces themselves don't have an implementation, so those
 diamond problems simply don't exist for them.


 Of course they do. If they inherit from 2 interfaces that have the same
 method with a different signature, you have a problem.

 InterfaceA = Interface
  Function IsValid : Integer;
 end;

 InterfaceB = Interface
  Function IsValid : String;
 end;

 How to define :

 InterfaceC = Interface(InterfaceA,InterfaceB)


I think, compile raise error duplicated methods, Same if inherit from one
and add a method already exists in parent interface.

Regards

-- 
Zaher Dirkey
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Inherit interface from 2 interfaces

2011-04-12 Thread Andreas Dorn

On Fri, 8 Apr 2011,michael.vancanneyt worte:

The whole idea of interfaces is to avoid multiple inheritance.


Hm. I don't believe that.

One of the major points of interfaces is indeed to avoid the problems
of multiple class inheritance (diamond problems - i.e. problems caused by
conflicting implementations of a method in different ancestor classes).

But Interfaces themselves don't have an implementation, so those
diamond problems simply don't exist for them.

I don't think there's a good reason against multiple interface inheritance.

Not having multiple interface inheritance complicated certain situations
for myself.. forcing me to put runtime interface-casts into my code that
a compiler with multiple interface inheritance could have checked at 
compiletime.

--
Andreas


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Inherit interface from 2 interfaces

2011-04-09 Thread Flávio Etrusco
On Fri, Apr 8, 2011 at 6:16 AM,  michael.vancann...@wisa.be wrote:


 On Fri, 8 Apr 2011, Zaher Dirkey wrote:

 2011/4/7 Flávio Etrusco flavio.etru...@gmail.com

 On Wed, Apr 6, 2011 at 1:37 PM, Zaher Dirkey parm...@gmail.com wrote:

 Can i do that?
 type
  IIntf3 = interface(IIntf11, IIntf2)
 
  end;

 Thanks in advance.
 --
 Zaher Dirkey


 For Corba interfaces, yes. Not for COM interfaces.
 http://www.freepascal.org/docs-html/ref/refse39.html


 I added {$INTERFACES CORBA} but same error ~Fatal: Syntax error, )
 expected but , found~ in the line ~IIntf3 = interface(IIntf11, IIntf2)~

 The whole idea of interfaces is to avoid multiple inheritance.

 So you can never inherit from more than one interface.

 Also not in CORBA interfaces. The mentioned page of the manual nowhere
 states that this is possible. It just says that for CORBA interfaces,
 the interface does not descend from IUnknown.

 Michael.

My bad, I just answered based on the Delphi implementation.
I sent the link just for the sake of reference.

Best regards,
Flávio
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Inherit interface from 2 interfaces

2011-04-08 Thread Zaher Dirkey
2011/4/7 Flávio Etrusco flavio.etru...@gmail.com

 On Wed, Apr 6, 2011 at 1:37 PM, Zaher Dirkey parm...@gmail.com wrote:
  Can i do that?
  type
IIntf3 = interface(IIntf11, IIntf2)
  
end;
 
  Thanks in advance.
  --
  Zaher Dirkey
 

 For Corba interfaces, yes. Not for COM interfaces.
 http://www.freepascal.org/docs-html/ref/refse39.html


I added {$INTERFACES CORBA} but same error ~Fatal: Syntax error, )
expected but , found~ in the line ~IIntf3 = interface(IIntf11, IIntf2)~

-- 
Zaher Dirkey
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Inherit interface from 2 interfaces

2011-04-08 Thread michael . vancanneyt



On Fri, 8 Apr 2011, Zaher Dirkey wrote:


2011/4/7 Flávio Etrusco flavio.etru...@gmail.com


On Wed, Apr 6, 2011 at 1:37 PM, Zaher Dirkey parm...@gmail.com wrote:

Can i do that?
type
  IIntf3 = interface(IIntf11, IIntf2)

  end;

Thanks in advance.
--
Zaher Dirkey



For Corba interfaces, yes. Not for COM interfaces.
http://www.freepascal.org/docs-html/ref/refse39.html



I added {$INTERFACES CORBA} but same error ~Fatal: Syntax error, )
expected but , found~ in the line ~IIntf3 = interface(IIntf11, IIntf2)~


The whole idea of interfaces is to avoid multiple inheritance.

So you can never inherit from more than one interface.

Also not in CORBA interfaces. The mentioned page of the manual nowhere
states that this is possible. It just says that for CORBA interfaces,
the interface does not descend from IUnknown.

Michael.___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Inherit interface from 2 interfaces

2011-04-07 Thread Flávio Etrusco
On Wed, Apr 6, 2011 at 1:37 PM, Zaher Dirkey parm...@gmail.com wrote:
 Can i do that?
 type
   IIntf3 = interface(IIntf11, IIntf2)
 
   end;

 Thanks in advance.
 --
 Zaher Dirkey


For Corba interfaces, yes. Not for COM interfaces.
http://www.freepascal.org/docs-html/ref/refse39.html

-Flávio
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Inherit interface from 2 interfaces

2011-04-06 Thread Juha (gmail)
Zaher Dirkey kirjoitti keskiviikko, 6. huhtikuuta 2011 19:37:04:
 Can i do that?
 type
   IIntf3 = interface(IIntf11, IIntf2)
 
   end;

No but you can do:
  type
  MyClass = class(IIntf11, IIntf2)

  end;


Juha
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal