Re: [Lazarus] IUnknown and reference counting

2013-04-16 Thread Marco van de Voort
On Thu, Mar 21, 2013 at 11:36:14AM +0100, Hans-Peter Diettrich wrote: > As already mentioned, Delphi interfaces are the workaround for the > missing multiple inheritance in OPL, as known from many languages > (Java...). Everything else IMO is language/implementation specific. I think they are pr

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Sven Barth
On 25.03.2013 19:54, Hans-Peter Diettrich wrote: Sven Barth schrieb: Am 25.03.2013 02:30, schrieb Hans-Peter Diettrich: So a mix of "implements" and delegates is supported, in contrast to the documentation? Can you explain what you mean with that? (perhaps using an example) Sorry, I was not

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Hans-Peter Diettrich
Sven Barth schrieb: Am 25.03.2013 02:30, schrieb Hans-Peter Diettrich: So a mix of "implements" and delegates is supported, in contrast to the documentation? Can you explain what you mean with that? (perhaps using an example) Sorry, I was not clear here. See http://bugs.freepascal.org/view.p

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Graeme Geldenhuys
On 2013-03-25 12:03, Hans-Peter Diettrich wrote: > may not, in detail when imported from other languages. So implementing > the reference counting methods IMO is the safe way, not using it should > be reserved for experts. No, just use the interface implementation (COM or CORBA) based on your ne

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Graeme Geldenhuys
On 2013-03-25 01:30, Hans-Peter Diettrich wrote: > > So a mix of "implements" and delegates is supported, in contrast to the > documentation? Just like Sven, I'm also a bit lost in what you mean. An example of the issue would be appreciated. Regards, - Graeme - -- fpGUI Toolkit - a cross-p

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Sven Barth
Am 25.03.2013 13:49, schrieb Michael Schnell: On 03/25/2013 11:05 AM, Sven Barth wrote: I'm not limiting it, I'm just saying what the main purpose of the concept "interface" is. IMHO regarding language features we should not discuss main purpose, but "basic purpose", in order to describe what c

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Sven Barth
Am 25.03.2013 02:30, schrieb Hans-Peter Diettrich: Graeme Geldenhuys schrieb: On 2013-03-21 17:46, Hans-Peter Diettrich wrote: Thanks for giving me insight into the crippled implementation of interfaces in FPC :-] Sorry, but you seem very confused. The default Interfaces "style" used by FPC i

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Sven Barth
Am 25.03.2013 13:03, schrieb Hans-Peter Diettrich: And I must do more work in my class by adding IUnknown to the TMySuperClass too. Dunno whether this is required for bare Delphi interfaces. Reference counting does not require IUnknown, as can be seen with dynamic arrays and strings. Delphi

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Hans-Peter Diettrich
Graeme Geldenhuys schrieb: On 2013-03-21 20:48, Hans-Peter Diettrich wrote: Sven Barth schrieb: On 21.03.2013 21:14, Hans-Peter Diettrich wrote: Sven Barth schrieb: > Thanks for giving me insight into the crippled implementation of interfaces in FPC :-] Why crippled? When FPC does not all

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Hans-Peter Diettrich
Graeme Geldenhuys schrieb: On 2013-03-21 17:46, Hans-Peter Diettrich wrote: Thanks for giving me insight into the crippled implementation of interfaces in FPC :-] Sorry, but you seem very confused. The default Interfaces "style" used by FPC is the COM-style interfaces. 100% compatible with Del

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Michael Schnell
On 03/25/2013 11:05 AM, Sven Barth wrote: I'm not limiting it, I'm just saying what the main purpose of the concept "interface" is. IMHO regarding language features we should not discuss main purpose, but "basic purpose", in order to describe what can be done and what can't be done. Also it sho

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Florian Klämpfl
Am 25.03.2013 11:05, schrieb Marco van de Voort: > > But I agree that the name was horribly, horribly chosen. Basically what > happened is that there was whining about how windows dependent the IUnknown > scheme was, when it was implemented, somebody mentioned Corba as non-Windows > possibility.

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Graeme Geldenhuys
On 2013-03-25 09:04, Sven Barth wrote: > His > point is the missing possibility to alias only a subset of an interfaces > function to a delegate which seems to be supported in Delphi OK, understood. But it still doesn't make FPC's interface support totally unusable. As far as I know, there are t

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Sven Barth
Am 25.03.2013 10:20, schrieb Michael Schnell: On 03/21/2013 09:51 PM, Sven Barth wrote: See also: http://en.wikipedia.org/wiki/Interface_%28object-oriented_programming%29 Why trying to limit the use of interface to "protocols" ? I'm not limiting it, I'm just saying what the main purpose of the

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Marco van de Voort
On Thu, Mar 21, 2013 at 08:26:21AM +, Graeme Geldenhuys wrote: > > Correct. And as Martin said, the name "CORBA" is a bit misleading. FPC > has no CORBA or ORB implementation, so no distributed communications can > be done out of the box. (Well, there is DCOM of course) > The interfaces in t

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Michael Schnell
On 03/21/2013 09:30 PM, Hans-Peter Diettrich wrote: object, at the same time from more than one thread? Then either call can interrupt the other one, with unpredictable results. Of course the results are very predictable (but complex). The problem is that they usually are not documented :-

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Michael Schnell
On 03/21/2013 06:46 PM, Hans-Peter Diettrich wrote: There are also enough people who consider to use FPC instead of Delphi, but cannot due to such incompatibilities. Thanks for giving me insight into the crippled implementation of interfaces in FPC :-] I suppose Strings is a much more common

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Michael Schnell
On 03/21/2013 06:39 PM, Hans-Peter Diettrich wrote: The same considerations apply to the use of object and interface references in threads. Interface methods are implemented by class methods, and consequently must not be called from multiple threads at the same time. As discussed already multipl

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Michael Schnell
On 03/21/2013 09:51 PM, Sven Barth wrote: See also: http://en.wikipedia.org/wiki/Interface_%28object-oriented_programming%29 Why trying to limit the use of interface to "protocols" ? -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepas

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Michael Schnell
On 03/21/2013 09:40 PM, Hans-Peter Diettrich wrote: Interfaces are there to abstract away the implementation, No, that's only a side-effect. As this is what the syntax provides, IMHO language-wise this is a major "effect". (See the example of creating an Algebra, using interfaces to allow

Re: [Lazarus] IUnknown and reference counting

2013-03-25 Thread Sven Barth
Am 25.03.2013 01:49, schrieb Graeme Geldenhuys: On 2013-03-21 17:46, Hans-Peter Diettrich wrote: Thanks for giving me insight into the crippled implementation of interfaces in FPC :-] Sorry, but you seem very confused. The default Interfaces "style" used by FPC is the COM-style interfaces. 100%

Re: [Lazarus] IUnknown and reference counting

2013-03-24 Thread Graeme Geldenhuys
On 2013-03-21 20:48, Hans-Peter Diettrich wrote: > Sven Barth schrieb: >> On 21.03.2013 21:14, Hans-Peter Diettrich wrote: >>> Sven Barth schrieb: >>> > Thanks for giving me insight into the crippled implementation of interfaces in FPC :-] Why crippled? >>> >>> When FPC does no

Re: [Lazarus] IUnknown and reference counting

2013-03-24 Thread Graeme Geldenhuys
On 2013-03-21 17:46, Hans-Peter Diettrich wrote: > > Thanks for giving me insight into the crippled implementation of > interfaces in FPC :-] Sorry, but you seem very confused. The default Interfaces "style" used by FPC is the COM-style interfaces. 100% compatible with Delphi. So I really do not

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Joao Morais
2013/3/21 Hans-Peter Diettrich : > Joao Morais schrieb: > >> 2013/3/21 Hans-Peter Diettrich : >>> >>> The same considerations apply to the use of object and interface >>> references >>> in threads. Interface methods are implemented by class methods, and >>> consequently must not be called from mult

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
On 21.03.2013 21:48, Hans-Peter Diettrich wrote: Also the hype about CORBA interfaces looks like mere eye-candy or obfuscation to me. Delphi interfaces require neither COM nor CORBA, they are only open in either direction. But some people don't like the reference counting. They want to use inte

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
On 21.03.2013 21:40, Hans-Peter Diettrich wrote: Sven Barth schrieb: On 21.03.2013 21:15, Hans-Peter Diettrich wrote: Sven Barth schrieb: > Interface delegation is something different from multiple inheritance. The interface implementor and the interfaced object then have nothing in common,

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Hans-Peter Diettrich
Sven Barth schrieb: On 21.03.2013 21:14, Hans-Peter Diettrich wrote: Sven Barth schrieb: > Thanks for giving me insight into the crippled implementation of interfaces in FPC :-] Why crippled? When FPC does not allow to use delegation ("implements") together with implementing selected metho

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Hans-Peter Diettrich
Sven Barth schrieb: On 21.03.2013 21:15, Hans-Peter Diettrich wrote: Sven Barth schrieb: > Interface delegation is something different from multiple inheritance. The interface implementor and the interfaced object then have nothing in common, the methods of the implementor cannot access eleme

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Hans-Peter Diettrich
Joao Morais schrieb: 2013/3/21 Hans-Peter Diettrich : The same considerations apply to the use of object and interface references in threads. Interface methods are implemented by class methods, and consequently must not be called from multiple threads at the same time. What's the problem calli

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
On 21.03.2013 21:15, Hans-Peter Diettrich wrote: Sven Barth schrieb: > Interface delegation is something different from multiple inheritance. The interface implementor and the interfaced object then have nothing in common, the methods of the implementor cannot access elements of the interfaced

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
On 21.03.2013 21:14, Hans-Peter Diettrich wrote: Sven Barth schrieb: > Thanks for giving me insight into the crippled implementation of interfaces in FPC :-] Why crippled? When FPC does not allow to use delegation ("implements") together with implementing selected methods, this feature is o

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Hans-Peter Diettrich
Sven Barth schrieb: > Interface delegation is something different from multiple inheritance. The interface implementor and the interfaced object then have nothing in common, the methods of the implementor cannot access elements of the interfaced object. But with only interfaces you inherit

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Hans-Peter Diettrich
Sven Barth schrieb: > Thanks for giving me insight into the crippled implementation of interfaces in FPC :-] Why crippled? When FPC does not allow to use delegation ("implements") together with implementing selected methods, this feature is of no practical use :-( Also the hype about COR

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Joao Morais
2013/3/21 Sven Barth : > On 21.03.2013 21:15, Joao Morais wrote: >> >> 2013/3/21 Hans-Peter Diettrich : >>> >>> The same considerations apply to the use of object and interface >>> references >>> in threads. Interface methods are implemented by class methods, and >>> consequently must not be called

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
On 21.03.2013 21:15, Joao Morais wrote: 2013/3/21 Hans-Peter Diettrich : The same considerations apply to the use of object and interface references in threads. Interface methods are implemented by class methods, and consequently must not be called from multiple threads at the same time. What'

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Joao Morais
2013/3/21 Graeme Geldenhuys : > On 2013-03-21 12:55, Kostas Michalopoulos wrote: >> properties. That could save a lot of headaches i have with my 3D world >> editor's lightmap generation (currently there is some wrong memory >> deallocation somewhere that crashes the editor in partial lightmap > >

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Joao Morais
2013/3/21 Hans-Peter Diettrich : > The same considerations apply to the use of object and interface references > in threads. Interface methods are implemented by class methods, and > consequently must not be called from multiple threads at the same time. What's the problem calling the same method,

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
Am 21.03.2013 18:58 schrieb "Hans-Peter Diettrich" : > > Sven Barth schrieb: > >> Am 21.03.2013 14:42, schrieb Michael Schnell: * the ability to delegate the implementation of the interface to a different class (using the "implements" keyword) >>> >>> To allow for a kind of multiple inher

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
Am 21.03.2013 18:58 schrieb "Hans-Peter Diettrich" : > > Sven Barth schrieb: > >> Am 21.03.2013 11:24, schrieb Hans-Peter Diettrich: >>> >>> In an Delphi-compatible implementation *all* classes implementing interfaces *must* be reference counted, so omitting this will result in incompatible code. >

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
Am 21.03.2013 18:58 schrieb "Hans-Peter Diettrich" : > > Sven Barth schrieb: > >> Am 21.03.2013 15:22, schrieb Kostas Michalopoulos: >>> >>> What i'm thinking right now is to simply create the lightmap objects (as interfaces) from the lightmapper side and send them to the 3D world side. My only con

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
Am 21.03.2013 18:58 schrieb "Hans-Peter Diettrich" : > > Kostas Michalopoulos schrieb: > >> Thanks, i understand that. My question is, can i somehow make FPC to add AddRef/Release calls also to TBlah so i can use refcounting with a class just like i would use it with an interface? > > > When you de

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Hans-Peter Diettrich
Sven Barth schrieb: Am 21.03.2013 15:22, schrieb Kostas Michalopoulos: What i'm thinking right now is to simply create the lightmap objects (as interfaces) from the lightmapper side and send them to the 3D world side. My only concern for now is if interfaces are thread safe (that is, what happ

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Hans-Peter Diettrich
Sven Barth schrieb: Am 21.03.2013 11:24, schrieb Hans-Peter Diettrich: In an Delphi-compatible implementation *all* classes implementing interfaces *must* be reference counted, so omitting this will result in incompatible code. So what? There are enough people on these lists that don't care whe

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Hans-Peter Diettrich
Kostas Michalopoulos schrieb: Thanks, i understand that. My question is, can i somehow make FPC to add AddRef/Release calls also to TBlah so i can use refcounting with a class just like i would use it with an interface? When you declare IBlah and implement it in TBlah, you can use: var MyBlah

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Hans-Peter Diettrich
Graeme Geldenhuys schrieb: On 2013-03-21 13:42, Michael Schnell wrote: * the ability to delegate the implementation of the interface to a different class (using the "implements" keyword) To allow for a kind of multiple inheritance, I supple. No, not at all. It is to reuse existing code. You c

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Hans-Peter Diettrich
Sven Barth schrieb: Am 21.03.2013 14:42, schrieb Michael Schnell: * the ability to delegate the implementation of the interface to a different class (using the "implements" keyword) To allow for a kind of multiple inheritance, I supple. It kind be used for a kind of multiple inheritance, but it

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Mark Morgan Lloyd
Sven Barth wrote: Am 21.03.2013 14:40, schrieb Mark Morgan Lloyd: Michael Schnell wrote: On 03/21/2013 12:30 PM, Graeme Geldenhuys wrote: COM is Component Object Model and DCOM is Distributed Component Object Model, developed by Microsoft. This only works on the Windows platform. That is how

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
Am 21.03.2013 15:22, schrieb Kostas Michalopoulos: What i'm thinking right now is to simply create the lightmap objects (as interfaces) from the lightmapper side and send them to the 3D world side. My only concern for now is if interfaces are thread safe (that is, what happens if two threads ke

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Kostas Michalopoulos
No, i never said that. I said that i have a problem with the way i'm using memory in my code currently (which is the result of the code doing stuff i didn't originally planned - in particular i didn't plan to have partial lightmap calculations) and i want to redesign it. Previously i would do eithe

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Kostas Michalopoulos
Ah, ok thanks for the explanations. On Thu, Mar 21, 2013 at 2:54 PM, Sven Barth wrote: > Am 21.03.2013 14:48, schrieb Kostas Michalopoulos: > > Thanks, i understand that. My question is, can i somehow make FPC to add >> AddRef/Release calls also to TBlah so i can use refcounting with a class >>

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Graeme Geldenhuys
On 2013-03-21 12:55, Kostas Michalopoulos wrote: > properties. That could save a lot of headaches i have with my 3D world > editor's lightmap generation (currently there is some wrong memory > deallocation somewhere that crashes the editor in partial lightmap Don't be fooled to think Interfaces i

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Graeme Geldenhuys
On 2013-03-21 13:42, Michael Schnell wrote: >> * the ability to delegate the implementation of the interface to a >> different class (using the "implements" keyword) > To allow for a kind of multiple inheritance, I supple. No, not at all. It is to reuse existing code. You can have one class (say

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
Am 21.03.2013 14:40, schrieb Mark Morgan Lloyd: Michael Schnell wrote: On 03/21/2013 12:30 PM, Graeme Geldenhuys wrote: COM is Component Object Model and DCOM is Distributed Component Object Model, developed by Microsoft. This only works on the Windows platform. That is how the do ActiveX, an

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
Am 21.03.2013 14:48, schrieb Kostas Michalopoulos: Thanks, i understand that. My question is, can i somehow make FPC to add AddRef/Release calls also to TBlah so i can use refcounting with a class just like i would use it with an interface? No. At least not yet (when a new Delphi is released w

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
Am 21.03.2013 14:42, schrieb Michael Schnell: * the ability to delegate the implementation of the interface to a different class (using the "implements" keyword) To allow for a kind of multiple inheritance, I supple. It kind be used for a kind of multiple inheritance, but it's main purpose is t

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Kostas Michalopoulos
Thanks, i understand that. My question is, can i somehow make FPC to add AddRef/Release calls also to TBlah so i can use refcounting with a class just like i would use it with an interface? Is there some technical limitation on why this is only done with interfaces and not all objects that descend

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Michael Schnell
On 03/21/2013 02:15 PM, Sven Barth wrote: If we put accounting the reference counting aspect then interfaces are exactly what it says on the tin: a interface (German: Schnittstelle) to a class. I see. I once saw an algebra done with certain objects using operator overloading and interfaces.

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Mark Morgan Lloyd
Michael Schnell wrote: On 03/21/2013 12:30 PM, Graeme Geldenhuys wrote: COM is Component Object Model and DCOM is Distributed Component Object Model, developed by Microsoft. This only works on the Windows platform. That is how the do ActiveX, and how Delphi does multi-tier support with MIDAS (

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
Am 21.03.2013 14:23, schrieb Kostas Michalopoulos: Yes, that is what i mean with "topmost" type: if you look at the inheritance as a tree, TInterfacedObject is the topmost (or root, if you think of it as an upside-down tree) of the type hierarchy. In this code type IBlah = interface ...

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Kostas Michalopoulos
Yes, that is what i mean with "topmost" type: if you look at the inheritance as a tree, TInterfacedObject is the topmost (or root, if you think of it as an upside-down tree) of the type hierarchy. In this code type IBlah = interface ... end; TBlah = class(TInterfacedObject, IBlah) ... en

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
Am 21.03.2013 14:15, schrieb Sven Barth: Am 21.03.2013 12:34, schrieb Michael Schnell: On 03/21/2013 11:36 AM, Hans-Peter Diettrich wrote: As already mentioned, Delphi interfaces are the workaround for the missing multiple inheritance in OPL, As you are stating yourself: multiple inheritan

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
Am 21.03.2013 12:34, schrieb Michael Schnell: On 03/21/2013 11:36 AM, Hans-Peter Diettrich wrote: As already mentioned, Delphi interfaces are the workaround for the missing multiple inheritance in OPL, As you are stating yourself: multiple inheritance does not introduce reference counting

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
Am 21.03.2013 13:55, schrieb Kostas Michalopoulos: I haven't used (COM) interfaces so far since i didn't found any use for them in my code, but i didn't knew about their reference counting properties. That could save a lot of headaches i have with my 3D world editor's lightmap generation (curre

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Kostas Michalopoulos
I haven't used (COM) interfaces so far since i didn't found any use for them in my code, but i didn't knew about their reference counting properties. That could save a lot of headaches i have with my 3D world editor's lightmap generation (currently there is some wrong memory deallocation somewhere

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Michael Schnell
On 03/21/2013 12:30 PM, Graeme Geldenhuys wrote: On 2013-03-21 08:33, Michael Schnell wrote: parameters to the IDE when designing the program ? Based on this, COM / CORBA / ORB might be described as specializations of the concept. I'm not sure I understand your question. COM is Component Objec

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Graeme Geldenhuys
On 2013-03-21 10:54, Sven Barth wrote: > If you just want plain interfaces like in Java and other > languages than you need to use what is called "CORBA" interfaces in FPC. Delphi doesn't have CORBA style interfaces like FPC. The work-around in Delphi was to implement TNullInterfacedObject which

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Michael Schnell
On 03/21/2013 11:36 AM, Hans-Peter Diettrich wrote: As already mentioned, Delphi interfaces are the workaround for the missing multiple inheritance in OPL, As you are stating yourself: multiple inheritance does not introduce reference counting and automatic create/destroy of an instance, i

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Graeme Geldenhuys
On 2013-03-21 08:33, Michael Schnell wrote: > parameters to the IDE when designing the program ? Based on this, COM / > CORBA / ORB might be described as specializations of the concept. I'm not sure I understand your question. COM is Component Object Model and DCOM is Distributed Component Objec

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
Am 21.03.2013 12:07, schrieb Benito van der Zander: The GUID is also necessary if you want to have "as" and "is" support. It is? I have been using interfaces without GUID and as/is works fine. At least as/is Tsomeclass That's because to support "Intf as/is ClassType" internally a hardcoded in

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Graeme Geldenhuys
On 2013-03-21 10:24, Hans-Peter Diettrich wrote: > > I'm not sure whether I understand what you did and want to achieve. It simple. I don't care about Delphi, because I use FPC for everything. I needed interfaces to mix in different behaviour into my existing classes, but I didn't need automatic

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Benito van der Zander
The GUID is also necessary if you want to have "as" and "is" support. It is? I have been using interfaces without GUID and as/is works fine. At least as/is Tsomeclass Benito On 03/20/2013 04:22 PM, Sven Barth wrote: Am 20.03.2013 15:28, schrieb Hans-Peter Diettrich: While I use interface b

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
Am 21.03.2013 11:24, schrieb Hans-Peter Diettrich: In an Delphi-compatible implementation *all* classes implementing interfaces *must* be reference counted, so omitting this will result in incompatible code. So what? There are enough people on these lists that don't care whether their code is D

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Sven Barth
Am 21.03.2013 11:36, schrieb Hans-Peter Diettrich: Michael Schnell schrieb: BTW.: Re. COM / CORBA / ORB Is there a decent way to describe the internal *Language-concept* (Interface, Interfaced object, ) (i.e. keywords, syntax, features, usability...) independently of paradigms dictated by

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Hans-Peter Diettrich
Michael Schnell schrieb: BTW.: Re. COM / CORBA / ORB Is there a decent way to describe the internal *Language-concept* (Interface, Interfaced object, ) (i.e. keywords, syntax, features, usability...) independently of paradigms dictated by the environment the executable is supposed to run

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Hans-Peter Diettrich
Graeme Geldenhuys schrieb: On 2013-03-21 07:07, Hans-Peter Diettrich wrote: Does this mean that CORBA interfaces are not reference counted at all, Correct. And as Martin said, the name "CORBA" is a bit misleading. FPC has no CORBA or ORB implementation, so no distributed communications can be

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Michael Schnell
BTW.: Re. COM / CORBA / ORB Is there a decent way to describe the internal *Language-concept* (Interface, Interfaced object, ) (i.e. keywords, syntax, features, usability...) independently of paradigms dictated by the environment the executable is supposed to run in and that might provide

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Graeme Geldenhuys
On 2013-03-21 07:07, Hans-Peter Diettrich wrote: > > Does this mean that CORBA interfaces are not reference counted at all, Correct. And as Martin said, the name "CORBA" is a bit misleading. FPC has no CORBA or ORB implementation, so no distributed communications can be done out of the box. The i

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Martin Schreiber
On Thursday 21 March 2013 08:07:56 Hans-Peter Diettrich wrote: > > > > CORBA style interfaces have no "required" methods to implement, so in > > such a case general interface support can be added to a TObject > > descendant simply by including the interface name in the class > > declaration. > > Do

Re: [Lazarus] IUnknown and reference counting

2013-03-21 Thread Hans-Peter Diettrich
Graeme Geldenhuys schrieb: On 2013-03-20 17:56, Hans-Peter Diettrich wrote: TInterfacedObject *simplifies* the addition of interfaces to derived classes Just for clarity [to the original poster]... that is only for COM style interfaces and the reference counting part. CORBA style interfaces

Re: [Lazarus] IUnknown and reference counting

2013-03-20 Thread Graeme Geldenhuys
On 2013-03-20 17:56, Hans-Peter Diettrich wrote: > TInterfacedObject *simplifies* the addition of interfaces to derived > classes Just for clarity [to the original poster]... that is only for COM style interfaces and the reference counting part. CORBA style interfaces have no "required" methods

Re: [Lazarus] IUnknown and reference counting

2013-03-20 Thread Hans-Peter Diettrich
Xiangrong Fang schrieb: As a matter of fact, this is what confused me the most. In my previous experience, e.g. with java or php, I don't care about COM or CORBA, interface to me is just another way to implement abstract method for languages that do not support multiple inheritance. Isn't that

Re: [Lazarus] IUnknown and reference counting

2013-03-20 Thread Hans-Peter Diettrich
Xiangrong Fang schrieb: OK, What confused me is the description found in FPC manual saying: TInterfacedObject is a descendent of TObject which implements the IUnknown

Re: [Lazarus] IUnknown and reference counting

2013-03-20 Thread Sven Barth
Am 20.03.2013 15:28, schrieb Hans-Peter Diettrich: While I use interface before in delphi and java, I didn't notice that I need a UUID for interface. I had an impression that it has something to do with COM? Right, an UUID/GUID for interfaces is Windows COM specific. So, what is the purpose

Re: [Lazarus] IUnknown and reference counting

2013-03-20 Thread Sven Barth
Am 20.03.2013 15:35, schrieb Xiangrong Fang: OK, What confused me is the description found in FPC manual saying: TInterfacedObject is a descendent of TObject which implements the IUnknown

Re: [Lazarus] IUnknown and reference counting

2013-03-20 Thread Xiangrong Fang
As a matter of fact, this is what confused me the most. In my previous experience, e.g. with java or php, I don't care about COM or CORBA, interface to me is just another way to implement abstract method for languages that do not support multiple inheritance. Isn't that the case? The reason I ask

Re: [Lazarus] IUnknown and reference counting

2013-03-20 Thread Graeme Geldenhuys
Hi, Dodi covered it all pretty much... On 2013-03-20 13:38, Xiangrong Fang wrote: > > So, what is the purpose of this UUID and the method provided by > TInterfacedObject? Only needed if you are doing COM programming under Windows. For the rest of the times you don't need it. Also note that som

Re: [Lazarus] IUnknown and reference counting

2013-03-20 Thread Xiangrong Fang
OK, What confused me is the description found in FPC manual saying: TInterfacedObject is a descendent of TObjectwhich implements the IUnknown interface. It can be used as a b

Re: [Lazarus] IUnknown and reference counting

2013-03-20 Thread Hans-Peter Diettrich
Xiangrong Fang schrieb: Hi, I am reading this: http://wiki.freepascal.org/How_To_Use_Interfaces And wondering what's the *purpose* of "reference counting"? Delphi (and FPC) implements garbage collection by reference counting. It's used in all dynamic (managed) datatypes, like arrays, interf

[Lazarus] IUnknown and reference counting

2013-03-20 Thread Xiangrong Fang
Hi, I am reading this: http://wiki.freepascal.org/How_To_Use_Interfaces And wondering what's the *purpose* of "reference counting"? While I use interface before in delphi and java, I didn't notice that I need a UUID for interface. I had an impression that it has something to do with COM? So, w