Re: [fpc-pascal] parent class as a parameter type

2011-11-17 Thread ik
On Mon, Nov 14, 2011 at 23:03, Jonas Maebe jonas.ma...@elis.ugent.bewrote: On 13 Nov 2011, at 17:56, Graeme Geldenhuys wrote: On 12/11/2011, ik idokan@ wrote: procedure foo(AClass : TStrings); foo(MyStringList); // Will return an error that TStrings is expected ... I can not

Re: [fpc-pascal] parent class as a parameter type

2011-11-17 Thread Sven Barth
Am 17.11.2011 09:23, schrieb ik: It's not allowed in Delphi in case of a var/out parameter. It's allowed in both FPC and Delphi in case of a value/const parameter. Sorry for the late response, but why does out and var limit this issue ? I understand that it does, but not the reason for

Re: [fpc-pascal] parent class as a parameter type

2011-11-17 Thread ik
On Thu, Nov 17, 2011 at 16:03, Sven Barth pascaldra...@googlemail.comwrote: Am 17.11.2011 09:23, schrieb ik: It's not allowed in Delphi in case of a var/out parameter. It's allowed in both FPC and Delphi in case of a value/const parameter. Sorry for the late response, but why does

Re: [fpc-pascal] parent class as a parameter type

2011-11-17 Thread Sven Barth
Am 17.11.2011 15:07, schrieb ik: On Thu, Nov 17, 2011 at 16:03, Sven Barth pascaldra...@googlemail.com mailto:pascaldra...@googlemail.com wrote: Am 17.11.2011 09:23, schrieb ik: It's not allowed in Delphi in case of a var/out parameter. It's allowed in both FPC and

Re: [fpc-pascal] parent class as a parameter type

2011-11-17 Thread ik
On Thu, Nov 17, 2011 at 16:15, Sven Barth pascaldra...@googlemail.comwrote: Am 17.11.2011 15:07, schrieb ik: On Thu, Nov 17, 2011 at 16:03, Sven Barth pascaldra...@googlemail.com mailto:pascaldragon@**googlemail.com pascaldra...@googlemail.com wrote: Am 17.11.2011 09:23, schrieb ik:

Re: [fpc-pascal] parent class as a parameter type

2011-11-17 Thread Mattias Gaertner
On Thu, 17 Nov 2011 15:15:46 +0100 Sven Barth pascaldra...@googlemail.com wrote: Am 17.11.2011 15:07, schrieb ik: On Thu, Nov 17, 2011 at 16:03, Sven Barth pascaldra...@googlemail.com mailto:pascaldra...@googlemail.com wrote: Am 17.11.2011 09:23, schrieb ik: It's not

Re: [fpc-pascal] parent class as a parameter type

2011-11-17 Thread Sven Barth
On 17.11.2011 19:07, Mattias Gaertner wrote: On Thu, 17 Nov 2011 15:15:46 +0100 Sven Barthpascaldra...@googlemail.com wrote: Emagine the following code: procedure Foo(var aList: TStrings); begin aList.Free; aList := TStrings.Create; end; var l: TStringList; begin l :=

Re: [fpc-pascal] parent class as a parameter type

2011-11-15 Thread Bart
On 12.11.2011 22:18, ik wrote: Since 2.6.0, when you write something like this: procedure foo(AClass : TStrings); foo(MyStringList); // Will return an error that TStrings is expected ... That would be strange indeed, because then most events (onclick handlers etc) would not compile anymore,

Re: [fpc-pascal] parent class as a parameter type

2011-11-15 Thread Felipe Monteiro de Carvalho
On Tue, Nov 15, 2011 at 10:10 AM, Bart bartjun...@gmail.com wrote: That would be strange indeed, because then most events (onclick handlers etc) would not compile anymore, since they are in the format procedure(Sender: TObject) of object... It is not like that, he forgot adding var or out to

Re: [fpc-pascal] parent class as a parameter type

2011-11-15 Thread Graeme Geldenhuys
On 15/11/2011, Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com wrote: On Tue, Nov 15, 2011 at 10:10 AM, Bart bartjun...@gmail.com wrote: That would be strange indeed, because then most events (onclick handlers etc) would not compile anymore, since they are in the format

Re: [fpc-pascal] parent class as a parameter type

2011-11-14 Thread Sven Barth
On 12.11.2011 22:18, ik wrote: Since 2.6.0, when you write something like this: procedure foo(AClass : TStrings); foo(MyStringList); // Will return an error that TStrings is expected ... I can not use TStringList as the parameter without casting it to TStrings. But I do not understand why this

Re: [fpc-pascal] parent class as a parameter type

2011-11-14 Thread Graeme Geldenhuys
On 12/11/2011, ik idokan@ wrote: Since 2.6.0, when you write something like this: I think it was even before this. procedure foo(AClass : TStrings); foo(MyStringList); // Will return an error that TStrings is expected ... I can not use TStringList as the parameter without casting it to

Re: [fpc-pascal] parent class as a parameter type

2011-11-14 Thread cobines
Works for me: program a; {$mode objfpc}{$H+} uses Classes; procedure foo(AClass: TStrings); begin end; var sl: TStringList; begin foo(sl); end. -- cobines ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] parent class as a parameter type

2011-11-14 Thread Jonas Maebe
On 12 Nov 2011, at 22:18, ik wrote: Since 2.6.0, when you write something like this: procedure foo(AClass : TStrings); foo(MyStringList); // Will return an error that TStrings is expected ... Are you certain there is no var or out in front of that parameter? I can not use TStringList as

Re: [fpc-pascal] parent class as a parameter type

2011-11-14 Thread Felipe Monteiro de Carvalho
On Sun, Nov 13, 2011 at 5:56 PM, Graeme Geldenhuys graemeg.li...@gmail.com wrote: Luckily I could change my code to TStringList to work around the problem. One can type-cast to get around the issue, so then method declarations don't need to be changed: foo(TStrings(MyStringList)); -- Felipe

Re: [fpc-pascal] parent class as a parameter type

2011-11-14 Thread Jonas Maebe
On 13 Nov 2011, at 17:56, Graeme Geldenhuys wrote: On 12/11/2011, ik idokan@ wrote: procedure foo(AClass : TStrings); foo(MyStringList); // Will return an error that TStrings is expected ... I can not use TStringList as the parameter without casting it to TStrings. But I do not

[fpc-pascal] parent class as a parameter type

2011-11-12 Thread ik
Hello List, Since 2.6.0, when you write something like this: procedure foo(AClass : TStrings); foo(MyStringList); // Will return an error that TStrings is expected ... I can not use TStringList as the parameter without casting it to TStrings. But I do not understand why this limitation added.