Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-03

interface "is" patch (finished and included)

9 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ml

i included again my refcount patch (haven't got even a little response on it. i'm slowly starting to wonder if i'm on the right mailing list (usually devel list is for internal purposes of regular developers, and others are... well,... for others (as well as bug reporting as patches)), i got more response on C operators (which i didn't even asked in fact) than on my first patch and error reports in interfaces)

would include auto_assign_of_guid patch too, but as much as i ask for somebody involved in compiler nobody answers, that one requires one change in lower levels

regards
ml

Reply by email

Michael Van Canneyt
to ml
ml wrote 6 lines
i included again my refcount patch (haven't got even a little response on it. i'm slowly starting to wonder if i'm on the right mailing list (usually devel list is for internal purposes of regular developers, and others are... well,... for others (as well as bug reporting as patches)), i got more response on C operators (which i didn't even asked in fact) than on my first patch and error reports in interfaces)

The core developers are quite busy people with daytime jobs. The effects of the patch can be quite tricky, which explains probably why they have not yet been applied.

would include auto_assign_of_guid patch too, but as much as i ask for somebody involved in compiler nobody answers, that one requires one change in lower levels

I guess Florian needs to answer this one, or peter.

I have downloaded and checked the patch, however I'm not a compiler person. The RTL patch looks OK to me. have you checked what happens with an object passed through COM ?

If either Florian or Peter give their blessing, I can commit the patch?

Michael.

Reply by email

Unknown author
to Michael Van Canneyt

Quoting Michael Van Canneyt :

Show quoted text 15 lines
On Thu, 31 Mar 2005, ml wrote: > i included again my refcount patch (haven't got even a little response > on it. i'm slowly starting to wonder if i'm on the right mailing list > (usually devel list is for internal purposes of regular developers, and > others are... well,... for others (as well as bug reporting as > patches)), i got more response on C operators (which i didn't even asked > in fact) than on my first patch and error reports in interfaces) The core developers are quite busy people with daytime jobs. The effects of the patch can be quite tricky, which explains probably why they have not yet been applied.

Daytime jobs? :) Well, isn't everybody:)
The effects of not being applied are even trickier.

Show quoted text 9 lines
> would include auto_assign_of_guid patch too, but as much as i ask for > somebody involved in compiler nobody answers, that one requires one > change in lower levels I guess Florian needs to answer this one, or peter. I have downloaded and checked the patch, however I'm not a compiler person. The RTL patch looks OK to me. have you checked what happens with an object passed through COM ?

COM? as I already said. COM objects have assigned GUID, And refcount gets incremented by 2 for those (and refcount is handled by fpc, and not COM), off course if it
would be the case of COM object there's nothing easier than check against IDispatch, as
I see IDispatch should be the root of COM objects with no object in fpc behind (at least based on Delphi documentation I got my self about interfaces to check Delphi compatibility), second option is to derive basic interface from IUnknown (IClassUnknown and this one is
bound to be referenced with class object behind), I already did that in my other patches). In any case patch to include that check would be either 2 or 5 liner. In either case refcount isn't working for fpc (not COM) based interfaces that don't have GUID 0 (side effect of GUID being 0 is that Supports, GetQuery and QueryInterface don't work, maybe fpc should report error for now if no GUID, I have a patch for that too).

But no, I haven't checked. I still have to set up some winblows machine. But lately I have too much work to do and as you know: "All work and no fun makes Jack a dull boy."

While on the other hand, "is" is nothing else but checking with GetQuery() and QueryInterface(), this one shouldn't make any problems. I checked, rechecked and then again checked. I only add two compilerprocs and invoked calling from tisnode, where it was denied by default. So if your code works mine does too.

regards
ml

Show quoted text 9 lines
If either Florian or Peter give their blessing, I can commit the patch? Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

---------------------------------------------------------------------- This mail sent through Horde-Toaster (http://qmailtoaster.clikka.com/)

Reply by email

Michael Van Canneyt
to Unknown author
Show quoted text 20 lines
Quoting Michael Van Canneyt : > > > On Thu, 31 Mar 2005, ml wrote: > >> i included again my refcount patch (haven't got even a little response >> on it. i'm slowly starting to wonder if i'm on the right mailing list >> (usually devel list is for internal purposes of regular developers, and >> others are... well,... for others (as well as bug reporting as >> patches)), i got more response on C operators (which i didn't even asked >> in fact) than on my first patch and error reports in interfaces) > > The core developers are quite busy people with daytime jobs. > The effects of the patch can be quite tricky, which explains > probably why they have not yet been applied. > Daytime jobs? :) Well, isn't everybody:) The effects of not being applied are even trickier.

Apparently not. The patch was studied by Peter:
1. It introduces a new feature, and as such will be only intyroduced after 2.0 has been released.
2. As a side effect, it allows assigning any class to any class, which is definitely wrong.

Show quoted text 35 lines
>> would include auto_assign_of_guid patch too, but as much as i ask for >> somebody involved in compiler nobody answers, that one requires one >> change in lower levels > > I guess Florian needs to answer this one, or peter. > > I have downloaded and checked the patch, however I'm not a compiler person. > The RTL patch looks OK to me. have you checked what happens with an object > passed through COM ? COM? as I already said. COM objects have assigned GUID, And refcount gets incremented by 2 for those (and refcount is handled by fpc, and not COM), off course if it would be the case of COM object there's nothing easier than check against IDispatch, as I see IDispatch should be the root of COM objects with no object in fpc behind (at least based on Delphi documentation I got my self about interfaces to check Delphi compatibility), second option is to derive basic interface from IUnknown (IClassUnknown and this one is bound to be referenced with class object behind), I already did that in my other patches). In any case patch to include that check would be either 2 or 5 liner. In either case refcount isn't working for fpc (not COM) based interfaces that don't have GUID 0 (side effect of GUID being 0 is that Supports, GetQuery and QueryInterface don't work, maybe fpc should report error for now if no GUID, I have a patch for that too). But no, I haven't checked. I still have to set up some winblows machine. But lately I have too much work to do and as you know: "All work and no fun makes Jack a dull boy." While on the other hand, "is" is nothing else but checking with GetQuery() and QueryInterface(), this one shouldn't make any problems. I checked, rechecked and then again checked. I only add two compilerprocs and invoked calling from tisnode, where it was denied by default. So if your code works mine does too.

Seems like after the patch too much wrong code is allowed to work as well :)

But I'm not qualified to speak about the compiler patches. Peter or Florian should do that.

Michael.

Reply by email

Thomas Schatzl
to Unknown author: Quoting Michael Van Canneyt : Daytime jobs? :) Well, isn't everybody:) The effects of not…
Show quoted text 13 lines
Quoting Michael Van Canneyt : > >On Thu, 31 Mar 2005, ml wrote: >I have downloaded and checked the patch, however I'm not a compiler person. >The RTL patch looks OK to me. have you checked what happens with an object >passed through COM ? COM? as I already said. COM objects have assigned GUID, And refcount gets incremented by 2 for those (and refcount is handled by fpc, and not COM), off course if it would be the case of COM object there's nothing easier than check against IDispatch, as I see IDispatch should be the root of COM objects with no object in fpc behind

No, the root of COM objects is IUnknown, IDispatch is optional for any COM object afaik.

Regards,
Thomas

Reply by email

Michael Van Canneyt
to Thomas Schatzl
Thomas Schatzl wrote 18 lines
schrieb: > Quoting Michael Van Canneyt : >> >> On Thu, 31 Mar 2005, ml wrote: >> I have downloaded and checked the patch, however I'm not a compiler >> person. The RTL patch looks OK to me. have you checked what happens with >> an object passed through COM ? > > COM? as I already said. COM objects have assigned GUID, And refcount gets > incremented by 2 for those (and refcount is handled by fpc, and not COM), > off > course if it > would be the case of COM object there's nothing easier than check against > IDispatch, as I see IDispatch should be the root of COM objects with no > object in fpc behind No, the root of COM objects is IUnknown, IDispatch is optional for any COM object afaik.

Correct.

Michael.

Reply by email

Unknown author
to Michael Van Canneyt: Apparently not. The patch was studied by Peter: 1. It introduces a new feature, and as…

Michael Van Canneyt :

Apparently not. The patch was studied by Peter: 1. It introduces a new feature, and as such will be only intyroduced after 2.0 has been released.

No trouble, it means that all interface features I'm implementing will probably (multilpe inheritance, object properties, interface handlers) go there (if accepted). It just means that I have more time to fit your needs better.

2. As a side effect, it allows assigning any class to any class, which is definitely wrong.

Easy fix, what do you need a compiler or runtime error? If I find time it may be today, but surely until start of the next week (I will not have my notebook where I'll reside, just public terminal). If I get it correctly, compiler error.

Show quoted text 5 lines
Seems like after the patch too much wrong code is allowed to work as well :) But I'm not qualified to speak about the compiler patches. Peter or Florian should do that.

Ok, no flexibility (:Doing other features too, and I didn't test object to object:) That was the reason for my try to ask questions "how would you like?" (I think that I at least 4 times asked whom to talk about how to implement). Now you finally said how. And patch will be corrected to fit constraints.

It is not my project and the last thing I would like would be enforcing unwanted boundaries (or the lack of it, it can still exist as my patch).

regards
ml

Show quoted text 6 lines
Michael. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

---------------------------------------------------------------------- This mail sent through Horde-Toaster (http://qmailtoaster.clikka.com/)

Reply by email

Florian Klaempfl
to ml: i included again my refcount patch (haven't got even a little response on it. i'm slowly…
ml wrote 6 lines
i included again my refcount patch (haven't got even a little response on it. i'm slowly starting to wonder if i'm on the right mailing list (usually devel list is for internal purposes of regular developers, and others are... well,... for others (as well as bug reporting as patches)), i got more response on C operators (which i didn't even asked in fact) than on my first patch and error reports in interfaces)

Sorry, currently I'am very busy with work and life ;( and I've still some other patches pending to review ...

Show quoted text 20 lines
diff -ruN fpc-1.9.8-patched/rtl/inc/objpas.inc fpc-1.9.8-devel/rtl/inc/objpas.inc --- fpc-1.9.8-patched/rtl/inc/objpas.inc 2005-03-27 20:09:37.000000000 +0200 +++ fpc-1.9.8-devel/rtl/inc/objpas.inc 2005-03-28 21:17:14.000000000 +0200 @@ -607,7 +607,7 @@ IEntry:=getinterfaceentry(iid); if Assigned(IEntry) then begin PPointer(@obj)^:=Pointer(Self)+IEntry^.IOffset; - intf_incr_ref(pointer(obj)); { it must be an com interface } +// intf_incr_ref(pointer(obj)); { it must be an com interface } getinterface:=True; end else begin @@ -623,8 +623,8 @@ IEntry:=getinterfaceentrybystr(iidstr); if Assigned(IEntry) then begin PPointer(@obj)^:=Pointer(Self)+IEntry^.IOffset; - if Assigned(IEntry^.iid) then { for Com interfaces } - intf_incr_ref(pointer(obj)); +// if Assigned(IEntry^.iid) then { for Com interfaces } +// intf_incr_ref(pointer(obj));

Any examples when this causes problems/why it is removed?

Show quoted text 10 lines
getinterfacebystr:=True; end else begin ------------------------------------------------------------------------ _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Unknown author
to Florian Klaempfl

Quoting Florian Klaempfl :

Show quoted text 37 lines
ml wrote: > i included again my refcount patch (haven't got even a little response > on it. i'm slowly starting to wonder if i'm on the right mailing list > (usually devel list is for internal purposes of regular developers, and > others are... well,... for others (as well as bug reporting as > patches)), i got more response on C operators (which i didn't even asked > in fact) than on my first patch and error reports in interfaces) Sorry, currently I'am very busy with work and life ;( and I've still some other patches pending to review ... > diff -ruN fpc-1.9.8-patched/rtl/inc/objpas.inc fpc-1.9.8-devel/rtl/inc/objpas.inc > --- fpc-1.9.8-patched/rtl/inc/objpas.inc 2005-03-27 20:09:37.000000000 +0200 > +++ fpc-1.9.8-devel/rtl/inc/objpas.inc 2005-03-28 21:17:14.000000000 +0200 > @@ -607,7 +607,7 @@ > IEntry:=getinterfaceentry(iid); > if Assigned(IEntry) then begin > PPointer(@obj)^:=Pointer(Self)+IEntry^.IOffset; > - intf_incr_ref(pointer(obj)); { it must be an com interface } > +// intf_incr_ref(pointer(obj)); { it must be an com interface } > getinterface:=True; > end > else begin > @@ -623,8 +623,8 @@ > IEntry:=getinterfaceentrybystr(iidstr); > if Assigned(IEntry) then begin > PPointer(@obj)^:=Pointer(Self)+IEntry^.IOffset; > - if Assigned(IEntry^.iid) then { for Com interfaces } > - intf_incr_ref(pointer(obj)); > +// if Assigned(IEntry^.iid) then { for Com interfaces } > +// intf_incr_ref(pointer(obj)); Any examples when this causes problems/why it is removed?

Yeah, here is a no brainerr.

type
  IA = interface
   ['{GUID NUMBER HERE']
   procedure A;
  end;
  TA = class(TInterfacedObject,IA)
    procedure A;
  end;
procedure TA.A;
begin
end;
var
  a,c: IA;
  b:TA;
begin
  b := TA.Create;
  a := b;
  c := b;
  a := b;
  c := b;
  a := b;
  c := b;
  a := b;
  c := b;
  Writeln('refount is ': b.refcount);
end.

Sorry, but I'm on public terminal
Refcount will be correct if guid won't be specified, but as soon as you specify, well you'll see

Show quoted text 17 lines
> getinterfacebystr:=True; > end > else begin > > > ------------------------------------------------------------------------ > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

---------------------------------------------------------------------- This mail sent through Horde-Toaster (http://qmailtoaster.clikka.com/)

Reply by email