Re: [fpc-devel] comparing methods

2009-09-15 Thread Den Jean
On Sunday 13 September 2009 23:38:08 Jonas Maebe wrote: > If the behaviour is different in Delphi. at least in kylix. this works in kylix and not in fpc $ cat hooks2.pas program hooks;

Re: [fpc-devel] comparing methods

2009-09-13 Thread Jonas Maebe
On 13 Sep 2009, at 23:32, Den Jean wrote: On Sunday 13 September 2009 22:05:17 Jonas Maebe wrote: That's why in objfpc mode you can (have to) use Hook_Signal (@MyMethod) I was rather hoping for an answer/fix for Delphi Mode. May I consider it a bug and file one ? If the behaviour is differ

Re: [fpc-devel] comparing methods

2009-09-13 Thread Den Jean
On Sunday 13 September 2009 22:05:17 Jonas Maebe wrote: > That's why in objfpc mode you can (have to) use Hook_Signal(@MyMethod) I was rather hoping for an answer/fix for Delphi Mode. May I consider it a bug and file one ? kind regards, Den Jean _

Re: [fpc-devel] comparing methods

2009-09-13 Thread Jonas Maebe
On 13 Sep 2009, at 22:02, Den Jean wrote: So I cannot directly give the hooked procedure as a parameter to a procedure, I have to do stuff like this var M : TMethod TSomeMethodTyp(M):=MyMethod Hook_Signal(M); Instead of Hook_Signal(MyMethod) That's why in objfpc mode you can (have to) use Hoo

Re: [fpc-devel] comparing methods

2009-09-13 Thread Den Jean
On Thursday 10 September 2009 16:56:20 Peter Vreman wrote: > You can use the TMethod record to access the fields: > writeln(hexstr(tmethod(@c.p).data)); > writeln(hexstr(tmethod(@c.p).code)); > end. kind of related to this, In the Qt binding I had to revert to a non type safe method for sign

Re: [fpc-devel] comparing methods

2009-09-12 Thread Martin Schreiber
On Saturday 12 September 2009 10:07:55 Mattias Gaertner wrote: > On Sat, 12 Sep 2009 09:33:11 +0200 > > > Martin, I hope you mean Data=ID and Code=nil. > Yup, you are right, thanks for correcting. Martin ___ fpc-devel maillist - fpc-devel@lists.freepa

Re: [fpc-devel] comparing methods

2009-09-12 Thread Mattias Gaertner
On Sat, 12 Sep 2009 09:33:11 +0200 Martin Schreiber wrote: > On Thursday 10 September 2009 19:42:22 Ivo Steinmann wrote: > > Florian Klaempfl schrieb: > > > Ivo Steinmann schrieb: > > >> 1. Using =nil or Assigned should result in the same. > > > > > > Afaik not, this was one of the reasons for as

Re: [fpc-devel] comparing methods

2009-09-12 Thread Martin Schreiber
On Thursday 10 September 2009 19:42:22 Ivo Steinmann wrote: > Florian Klaempfl schrieb: > > Ivo Steinmann schrieb: > >> 1. Using =nil or Assigned should result in the same. > > > > Afaik not, this was one of the reasons for assigned. > > > > well, nobody seems to know it... eg. if you go through c

Re: [fpc-devel] comparing methods

2009-09-11 Thread Mattias Gärtner
Zitat von Michael Schnell : Mattias Gärtner wrote: The @ operator is more than "address of". Hmm "Address of" is not that simple in itself. :) With a "Procedure of Object", "@" of course handles the Self pointer, too. I suppose to find the address of a function "@" uses the Virtual Method

Re: [fpc-devel] comparing methods

2009-09-11 Thread Nino Luciani
On Thursday 10 September 2009 17:52:44 Florian Klaempfl wrote: > Ivo Steinmann schrieb: > > 1. Using =nil or Assigned should result in the same. > > Afaik not, this was one of the reasons for assigned. > I have always used Assigned() to test whether a pointer is 'valid' or is nil. Thus Assiged()

Re: [fpc-devel] comparing methods

2009-09-11 Thread Michael Schnell
Mattias Gärtner wrote: > > The @ operator is more than "address of". > Hmm "Address of" is not that simple in itself. :) With a "Procedure of Object", "@" of course handles the Self pointer, too. I suppose to find the address of a function "@" uses the Virtual Method Table found with the Self

Re: [fpc-devel] comparing methods

2009-09-10 Thread Sergei Gorelkin
Michael Van Canneyt wrote: On Thu, 10 Sep 2009, Florian Klaempfl wrote: Mattias Gaertner schrieb: On Thu, 10 Sep 2009 17:52:44 +0200 Florian Klaempfl wrote: Ivo Steinmann schrieb: 1. Using =nil or Assigned should result in the same. Afaik not, this was one of the reasons for assigned.

Re: [fpc-devel] comparing methods

2009-09-10 Thread Ivo Steinmann
Florian Klaempfl schrieb: Ivo Steinmann schrieb: 1. Using =nil or Assigned should result in the same. Afaik not, this was one of the reasons for assigned. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/

Re: [fpc-devel] comparing methods

2009-09-10 Thread Michael Van Canneyt
On Thu, 10 Sep 2009, Florian Klaempfl wrote: Mattias Gaertner schrieb: On Thu, 10 Sep 2009 17:52:44 +0200 Florian Klaempfl wrote: Ivo Steinmann schrieb: 1. Using =nil or Assigned should result in the same. Afaik not, this was one of the reasons for assigned. Are there any other reasons

Re: [fpc-devel] comparing methods

2009-09-10 Thread Florian Klaempfl
Mattias Gaertner schrieb: > On Thu, 10 Sep 2009 17:52:44 +0200 > Florian Klaempfl wrote: > >> Ivo Steinmann schrieb: >>> 1. Using =nil or Assigned should result in the same. >> Afaik not, this was one of the reasons for assigned. > > Are there any other reasons for assigned? Distinction between

Re: [fpc-devel] comparing methods

2009-09-10 Thread Mattias Gaertner
On Thu, 10 Sep 2009 17:52:44 +0200 Florian Klaempfl wrote: > Ivo Steinmann schrieb: > > > > 1. Using =nil or Assigned should result in the same. > > Afaik not, this was one of the reasons for assigned. Are there any other reasons for assigned? Mattias _

Re: [fpc-devel] comparing methods

2009-09-10 Thread Martin
Mattias Gärtner wrote: Zitat von Michael Schnell : Mattias Gärtner wrote: Can someone explain why in mode objfpc comparing methods only compares the address, but not the instance? Seems perfectly logical to me (@ = Address of, in this case "code address", the code is the same for all instances

Re: [fpc-devel] comparing methods

2009-09-10 Thread Florian Klaempfl
Ivo Steinmann schrieb: > > 1. Using =nil or Assigned should result in the same. Afaik not, this was one of the reasons for assigned. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel

Re: [fpc-devel] comparing methods

2009-09-10 Thread Desmond Coertzen
Thank you Peter. TMethod would have been handy if i knew about this back then. For delphi compatibility, I had to do this: program methodpointer; uses Classes, sysutils; type TMyEvent = procedure of object; TMyClass = class(TObject) procedure MyMethod; end; { TMyClass } procedure

Re: [fpc-devel] comparing methods

2009-09-10 Thread Ivo Steinmann
Mattias Gärtner schrieb: Zitat von Vincent Snijders : Jonas Maebe schreef: On 10 Sep 2009, at 14:01, Mattias Gärtner wrote: Mattias Gärtner wrote: Can someone explain why in mode objfpc comparing methods only compares the address, but not the instance? Seems perfectly logical to me (@

Re: [fpc-devel] comparing methods

2009-09-10 Thread Peter Vreman
On Thu, 10 Sep 2009 14:25:26 +, Desmond Coertzen wrote: > I have done some horrible code where I needed to know the following: > > If TSomeProc = procedure(), then is it easy to determine or set entry > vector of ThatProc: TSomeProc by stating ThatProc := > @ProcWhereTheCodeLives_InTheCod

Re: [fpc-devel] comparing methods

2009-09-10 Thread Desmond Coertzen
I have done some horrible code where I needed to know the following: If TSomeProc = procedure(), then is it easy to determine or set entry vector of ThatProc: TSomeProc by stating ThatProc := @ProcWhereTheCodeLives_InTheCodeSegment; It gets more difficult when you work with TSomeClassProc = p

Re: [fpc-devel] comparing methods

2009-09-10 Thread Mattias Gärtner
Zitat von Vincent Snijders : Jonas Maebe schreef: On 10 Sep 2009, at 14:01, Mattias Gärtner wrote: Mattias Gärtner wrote: Can someone explain why in mode objfpc comparing methods only compares the address, but not the instance? Seems perfectly logical to me (@ = Address of, in this case

Re: [fpc-devel] comparing methods

2009-09-10 Thread Mattias Gärtner
Zitat von Jonas Maebe : On 10 Sep 2009, at 14:01, Mattias Gärtner wrote: Mattias Gärtner wrote: Can someone explain why in mode objfpc comparing methods only compares the address, but not the instance? Seems perfectly logical to me (@ = Address of, in this case "code address", the code is

Re: [fpc-devel] comparing methods

2009-09-10 Thread Mattias Gärtner
Zitat von Thaddy : Mattias Gärtner wrote: Zitat von Michael Schnell : Mattias Gärtner wrote: Can someone explain why in mode objfpc comparing methods only compares the address, but not the instance? Seems perfectly logical to me (@ = Address of, in this case "code address", the code is the

Re: [fpc-devel] comparing methods

2009-09-10 Thread Vincent Snijders
Jonas Maebe schreef: On 10 Sep 2009, at 14:01, Mattias Gärtner wrote: Mattias Gärtner wrote: Can someone explain why in mode objfpc comparing methods only compares the address, but not the instance? Seems perfectly logical to me (@ = Address of, in this case "code address", the code is the

Re: [fpc-devel] comparing methods

2009-09-10 Thread Thaddy
Mattias Gärtner wrote: Zitat von Michael Schnell : Mattias Gärtner wrote: Can someone explain why in mode objfpc comparing methods only compares the address, but not the instance? Seems perfectly logical to me (@ = Address of, in this case "code address", the code is the same for all instanc

Re: [fpc-devel] comparing methods

2009-09-10 Thread Jonas Maebe
On 10 Sep 2009, at 14:01, Mattias Gärtner wrote: Mattias Gärtner wrote: Can someone explain why in mode objfpc comparing methods only compares the address, but not the instance? Seems perfectly logical to me (@ = Address of, in this case "code address", the code is the same for all instan

Re: [fpc-devel] comparing methods

2009-09-10 Thread Mattias Gärtner
Zitat von Michael Schnell : Mattias Gärtner wrote: Can someone explain why in mode objfpc comparing methods only compares the address, but not the instance? Seems perfectly logical to me (@ = Address of, in this case "code address", the code is the same for all instances of a class). OnClic

Re: [fpc-devel] comparing methods

2009-09-10 Thread Thaddy
Mattias Gärtner wrote: Hi, Can someone explain why in mode objfpc comparing methods only compares the address, but not the instance? For example: a:=TMyClass.Create; b:=TMyClass.Create; if @a.test = @b.test then writeln('the same method'); This results in strange behaviors, when using

Re: [fpc-devel] comparing methods

2009-09-10 Thread Michael Schnell
Mattias Gärtner wrote: > Can someone explain why in mode objfpc comparing methods only compares > the address, but not the instance? Seems perfectly logical to me (@ = Address of, in this case "code address", the code is the same for all instances of a class). -Michael ___