Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Graeme Geldenhuys
Michael Van Canneyt het geskryf: > > You only need var/out when you want to change the instance pointer, i.e. > switch to another instance. And I count FreeAndNil() among this. (.Free > on the other hand is still possible, but not recommended). > > If you just want to set properties or call met

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Graeme Geldenhuys
Jonas Maebe het geskryf: > > This is also documented at http://wiki.freepascal.org/User_Changes_Trunk > , the first place to look when switching from the fixes branch to trunk. > > Thanks, I bookmarked that link. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using F

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Michael Van Canneyt
On Mon, 17 May 2010, Graeme Geldenhuys wrote: Michael Van Canneyt het geskryf: You only need var/out when you want to change the instance pointer, i.e. switch to another instance. And I count FreeAndNil() among this. (.Free on the other hand is still possible, but not recommended). If you

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Martin
On 14/05/2010 15:52, Mattias Gaertner wrote: "var" means, you can do this: type TQStrings = class(TStrings) end; procedure A(var s: TStrings); begin s:=TQStrings.Create; end; Then your TStringList will no longer be a TStringList. That's why 'var' must match exactly. Same for out. Cons

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Mattias Gaertner
On Mon, 17 May 2010 10:05:27 +0100 Martin wrote: > On 14/05/2010 15:52, Mattias Gaertner wrote: > > "var" means, you can do this: > > > > type > >TQStrings = class(TStrings) > >end; > > > > procedure A(var s: TStrings); > > begin > >s:=TQStrings.Create; > > end; > > > > Then your TStr

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Martin
On 17/05/2010 10:29, Mattias Gaertner wrote: On Mon, 17 May 2010 10:05:27 +0100 Martin wrote: On 14/05/2010 15:52, Mattias Gaertner wrote: "var" means, you can do this: type TQStrings = class(TStrings) end; procedure A(var s: TStrings); begin s:=TQStrings.Create; end;

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Graeme Geldenhuys
Hi, Sorry, I'm still battling with this. My original code looked as follows: procedure TfpgApplicationBase.CreateForm(AFormClass: TComponentClass; out AForm: TfpgWindowBase); begin try AForm := TfpgWindowBase(AFormClass.Create(self)); if FMainForm = nil then FMainForm := AForm;

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Mattias Gaertner
On Mon, 17 May 2010 10:40:12 +0100 Martin wrote: > On 17/05/2010 10:29, Mattias Gaertner wrote: >[...] > > Theoretically: yes, this could work for classes. > > But as Jonas explained a few times: 'out' is *not* write only. > > Out is finalised and must therefore match exactly. > > And even wr

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Michael Van Canneyt
On Mon, 17 May 2010, Graeme Geldenhuys wrote: Hi, Sorry, I'm still battling with this. My original code looked as follows: procedure TfpgApplicationBase.CreateForm(AFormClass: TComponentClass; out AForm: TfpgWindowBase); begin try AForm := TfpgWindowBase(AFormClass.Create(self)); if F

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Graeme Geldenhuys
Michael Van Canneyt het geskryf: > > And correctly so, because you need the OUT: you are modifying the pointer > and need to pass back the modified pointer to the caller. Yes, but I can't use OUT because the type of AForm doesn't match exactly - back to my initial problem when I started with FPC

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Martin
On 17/05/2010 10:47, Mattias Gaertner wrote: On Mon, 17 May 2010 10:40:12 +0100 Martin wrote: On 17/05/2010 10:29, Mattias Gaertner wrote: [...] Theoretically: yes, this could work for classes. But as Jonas explained a few times: 'out' is *not* write only. Out is finalised and must

Re: [fpc-devel] order of tar parameters during make zipinstall

2010-05-17 Thread Joost van der Sluis
On Sat, 2010-05-15 at 22:35 +0200, Den Jean wrote: > Hi, > > make zipinstall does not work for my busybox tar > > the call to tar is made like this: > /bin/tar cfvz /svn/fpc/fpc-2.5.1.arm-linux.tar.gz * > but my system tar wants the option 'f' right in front of the target filename. > > Makefile

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Florian Klaempfl
Graeme Geldenhuys schrieb: > Michael Van Canneyt het geskryf: >> And correctly so, because you need the OUT: you are modifying the pointer >> and need to pass back the modified pointer to the caller. > > Yes, but I can't use OUT because the type of AForm doesn't match exactly - > back to my initia

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Mattias Gaertner
On Mon, 17 May 2010 11:41:22 +0200 Graeme Geldenhuys wrote: >[...] > Looking at the Lazarus code for Application.CreateForm. Now they do other > strange things too, creating a instance without calling the constructor > etc... This doesn't seem like something I want either and still doesn't > solv

Re: [fpc-devel] order of tar parameters during make zipinstall

2010-05-17 Thread Den Jean
On Saturday 15 May 2010 22:35:23 Den Jean wrote: > If someone agrees to fix this, I'll make a bug report > done http://bugs.freepascal.org/view.php?id=16504 including patch proposal ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.

[fpc-devel] Armel problems

2010-05-17 Thread Den Jean
Hi, I am investigating why Qt on armel has problems. I think that one of the problems is that when c-functions are called from pascal that the parameters are not passed correctly (or not as I expected and accommodated for). I noticed that when the parameter is a "" like @MyMethod (method of

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Vinzent Höfler
Florian Klaempfl : > Graeme Geldenhuys schrieb: > > > This compiler change will play havoc on the Simple Factory Method design > > pattern as well - a base class is used as the parameter type, but > > descendants are created and passed back. This is a very common case and > > used a lot. > > ...

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Marcos Douglas
On Mon, May 17, 2010 at 4:24 PM, Florian Klaempfl wrote: > > ... and one uses normally a function and not a var/out parameter. No... If you forget to put a variable to receive the function result (a object created), a memory leak will happen. The "out" parameter requires a variable. Marcos Doug

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Florian Klaempfl
Vinzent Höfler schrieb: > Florian Klaempfl : > >> Graeme Geldenhuys schrieb: >> >>> This compiler change will play havoc on the Simple Factory Method design >>> pattern as well - a base class is used as the parameter type, but >>> descendants are created and passed back. This is a very common case

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Martin
On 17/05/2010 22:10, Marcos Douglas wrote: On Mon, May 17, 2010 at 4:24 PM, Florian Klaempfl wrote: ... and one uses normally a function and not a var/out parameter. No... If you forget to put a variable to receive the function result (a object created), a memory leak will happen. T

Re[2]: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread José Mejuto
Hello Graeme, Monday, May 17, 2010, 11:56:29 AM, you wrote: GG> Yes, but I can't use OUT because the type of AForm doesn't match exactly - GG> back to my initial problem when I started with FPC 2.5.1. GG> TfpgWindowBase vs TBulkInvoiceRateListForm type. So you do not need "out" you need the no

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Henry Vermaak
On 17 May 2010 21:59, "Vinzent Höfler" wrote: > Florian Klaempfl : > >> Graeme Geldenhuys schrieb: >> >> > This compiler change will play havoc on the Simple Factory Method design >> > pattern as well - a base class is used as the parameter type, but >> > descendants are created and passed back. T

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Vinzent Höfler
Florian Klaempfl : > Vinzent Höfler schrieb: > > Florian Klaempfl : > > > >> Graeme Geldenhuys schrieb: > >> > >>> This compiler change will play havoc on the Simple Factory Method > design > >>> pattern as well - a base class is used as the parameter type, but > >>> descendants are created and p

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Vinzent Höfler
Henry Vermaak > On 17 May 2010 21:59, "Vinzent Höfler" > wrote: > > Florian Klaempfl : > > > >> Graeme Geldenhuys schrieb: > >> > >> > This compiler change will play havoc on the Simple Factory Method > design > >> > pattern as well - a base class is used as the parameter type, but > >> > descen

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Graeme Geldenhuys
Florian Klaempfl het geskryf: > > ... and one uses normally a function and not a var/out parameter. The design pattern doesn't specify that. The developer can implement it as they see if. A parameter or a function return type - I have see and used both methods. Regards, - Graeme - -- fpGUI

Re: [fpc-devel] Parameters must match exactly?

2010-05-17 Thread Graeme Geldenhuys
Florian Klaempfl het geskryf: > http://en.wikipedia.org/wiki/Factory_method_pattern >> Sorry for the sarcasm, > > Sarcasm? For sarcasm, you need to have a clue. No need to be rude. Maybe I can chip in, because design patterns are right up my alley. Maybe you forgot, but a design pattern is not