Re: [fpc-pascal] non-virtual class methods called from virtual regular method

2021-04-29 Thread Jonas Maebe via fpc-pascal
On 29/04/2021 13:04, LacaK via fpc-pascal wrote: > In regular virtual method, I expect, that Self resolves to runtime class > type, thust calling CP1 should resolve to runtime type class method. It works the same for class methods and non-class methods: no virtual = no dynamic resolution when

Re: [fpc-pascal] Detecting IO errors with INI file

2021-04-29 Thread James Richters via fpc-pascal
Thanks everyone for the help. I have it working now I did some more searching and found out I can get "Try" to work with {$Mode TP} If I add {$Modeswitch exceptions} and appearantly {$R+} to make sure range checking is on. So I have it working in my {$Mode TP} Unit.

[fpc-pascal] Array range overflow in properties

2021-04-29 Thread Ryan Joseph via fpc-pascal
Is this a bug in properties and I should be getting an error? type TPixel = record components: array[0..3] of byte; property R: byte read components[10] write components[10]; end; Regards, Ryan Joseph ___

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-29 Thread Ryan Joseph via fpc-pascal
> On Apr 29, 2021, at 12:01 AM, Sven Barth wrote: > > To be precise there are two more: function/procedure variables (no special > designator) and method variables ("of object"). Depending on what a anonymous > function captures (or for the sake of it a nested function) it would be >

Re: [fpc-pascal] Detecting IO errors with INI file

2021-04-29 Thread Michael Van Canneyt via fpc-pascal
On Thu, 29 Apr 2021, James Richters via fpc-pascal wrote: Best add SysUtils and Classes. Thanks, that worked. But now I'm getting "cannot read or write variables of this type" for Writeln(Exception) is there an easy way to find out what the exception is? On E : Exception do

Re: [fpc-pascal] Detecting IO errors with INI file

2021-04-29 Thread James Richters via fpc-pascal
>Best add SysUtils and Classes. Thanks, that worked. But now I'm getting "cannot read or write variables of this type" for Writeln(Exception) is there an easy way to find out what the exception is? James ___ fpc-pascal maillist -

Re: [fpc-pascal] non-virtual class methods called from virtual regular method

2021-04-29 Thread Michael Van Canneyt via fpc-pascal
On Thu, 29 Apr 2021, LacaK via fpc-pascal wrote: Dňa 29.4.2021 o 9:26 Michael Van Canneyt via fpc-pascal napísal(a): On Thu, 29 Apr 2021, LacaK via fpc-pascal wrote: Hi *, consider the following example T1 = class   class procedure CP1;   procedure P1; virtual; end; T2 = class(T1)  

Re: [fpc-pascal] Detecting IO errors with INI file

2021-04-29 Thread Michael Van Canneyt via fpc-pascal
On Thu, 29 Apr 2021, James Richters via fpc-pascal wrote: I’m trying to put the Ini file stuff all in it’s own unit. My unit is {$Mode OBJFPC} and Uses IniFiles; “Try” is compiling, but I’m getting Error: Identifier not found “EFOpenError” And also Syntax error “Do” expected but “)” found

Re: [fpc-pascal] non-virtual class methods called from virtual regular method

2021-04-29 Thread LacaK via fpc-pascal
Dňa 29.4.2021 o 9:26 Michael Van Canneyt via fpc-pascal napísal(a): On Thu, 29 Apr 2021, LacaK via fpc-pascal wrote: Hi *, consider the following example T1 = class   class procedure CP1;   procedure P1; virtual; end; T2 = class(T1)   class procedure CP1; end; procedure T1.P1; begin  

Re: [fpc-pascal] Detecting IO errors with INI file

2021-04-29 Thread James Richters via fpc-pascal
I’m trying to put the Ini file stuff all in it’s own unit. My unit is {$Mode OBJFPC} and Uses IniFiles; “Try” is compiling, but I’m getting Error: Identifier not found “EFOpenError” And also Syntax error “Do” expected but “)” found I have: try Log_ini := TIniFile.Create('myini.ini');

Re: [fpc-pascal] Detecting IO errors with INI file

2021-04-29 Thread Sven Barth via fpc-pascal
James Richters schrieb am Do., 29. Apr. 2021, 10:33: > I get Error: Identifier not found “Try” > > Because my unit must be compiled with {$MODE TP} > You can try to use {$modeswitch exceptions}, I think. Otherwise quite a few procedures and functions won’t even compile that only > work in

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-29 Thread Tomas Hajny via fpc-pascal
On 2021-04-29 09:00, Mattias Gaertner via fpc-pascal wrote: On Thu, 29 Apr 2021 07:52:19 +0200 Sven Barth via fpc-pascal wrote: [...] You completely ignored my first point, which in this case is the much more significant one: Pascal does not support type inference. FPC does not. Delphi

Re: [fpc-pascal] Detecting IO errors with INI file

2021-04-29 Thread James Richters via fpc-pascal
I get Error: Identifier not found “Try” Because my unit must be compiled with {$MODE TP} Otherwise quite a few procedures and functions won’t even compile that only work in Turbo Pascal mode. I guess I can put it in another unit and make a call to that… then I can use Try Thanks for the

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-29 Thread Graeme Geldenhuys via fpc-pascal
On 29/04/2021 8:00 am, Mattias Gaertner via fpc-pascal wrote: > FPC does not. > Delphi does: If only FPC would have strived to be Delphi Compatible. ;-) :-P Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] non-virtual class methods called from virtual regular method

2021-04-29 Thread Michael Van Canneyt via fpc-pascal
On Thu, 29 Apr 2021, LacaK via fpc-pascal wrote: Hi *, consider the following example T1 = class   class procedure CP1;   procedure P1; virtual; end; T2 = class(T1)   class procedure CP1; end; procedure T1.P1; begin   CP1; // here is called allways T1.CP1, right?   // if I want call

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-29 Thread Mattias Gaertner via fpc-pascal
On Thu, 29 Apr 2021 07:52:19 +0200 Sven Barth via fpc-pascal wrote: >[...] > You completely ignored my first point, which in this case is the much > more significant one: Pascal does not support type inference. FPC does not. Delphi does:

[fpc-pascal] non-virtual class methods called from virtual regular method

2021-04-29 Thread LacaK via fpc-pascal
Hi *, consider the following example T1 = class   class procedure CP1;   procedure P1; virtual; end; T2 = class(T1)   class procedure CP1; end; procedure T1.P1; begin   CP1; // here is called allways T1.CP1, right?   // if I want call T2.CP1 then class procedure CP1 must be also virtual,

Re: [fpc-pascal] [fpc-devel] Nested function closures

2021-04-29 Thread Sven Barth via fpc-pascal
Ryan Joseph via fpc-pascal schrieb am Mi., 28. Apr. 2021, 17:53: > > > > On Apr 27, 2021, at 11:36 PM, Sven Barth > wrote: > > > > Anyway, it would in principle be possible to convert an anonymous > function to a "is nested" function, but that will only come *after* the > whole implementation