Re: RE : RE : [fpc-pascal] Dynamically Execute method

2012-06-19 Thread ik
On Tue, Jun 19, 2012 at 10:38 AM, Ludo Brands wrote: > > > As Bern said you can't call an object method without passing > > the reference to the instance. In this case you are lucky > > because TMyClass.SayHi doesn't use any properties or class > > vars. Add a property to TMyClass and try to writ

RE : RE : [fpc-pascal] Dynamically Execute method

2012-06-19 Thread Ludo Brands
> As Bern said you can't call an object method without passing > the reference to the instance. In this case you are lucky > because TMyClass.SayHi doesn't use any properties or class > vars. Add a property to TMyClass and try to writeln that > property and you will see it fails. What you are

Re: [fpc-pascal] Dynamically Execute method

2012-06-19 Thread Mattias Gaertner
On Tue, 19 Jun 2012 00:22:29 +0300 ik wrote: > Hi, > > I'm playing a bit with the notion of execute a method dynamically on demand. > I'ved created the following PoC: > https://gist.github.com/2950789 > > It works, but for some strange reason, I find myself feeling that I'm > missing something,

RE : [fpc-pascal] Dynamically Execute method

2012-06-19 Thread Ludo Brands
> Seems to work for me, updated the example: https://gist.github.com/2950789 > > Or am O missing something ? Change your method to procedure TMyClass.SayHi; begin writeln('Hi World from '+IntToStr(ptruint(self))); end; And the test to write('From MyClass2 : '); MyClass2.SayHi; if not Exe

Re: [fpc-pascal] Dynamically Execute method

2012-06-18 Thread ik
On Tue, Jun 19, 2012 at 12:51 AM, Bernd wrote: > 2012/6/18 ik : > > Hi, > > > > I'm playing a bit with the notion of execute a method dynamically on > demand. > > I'ved created the following PoC: > > https://gist.github.com/2950789 > > Souldn't this be > > Exec: procedure of object; > > instead o

Re: [fpc-pascal] Dynamically Execute method

2012-06-18 Thread Bernd
2012/6/18 ik : > Hi, > > I'm playing a bit with the notion of execute a method dynamically on demand. > I'ved created the following PoC: > https://gist.github.com/2950789 Souldn't this be Exec: procedure of object; instead of only procedure? Imho one pointer alone can not be enough, it should ne