[fpc-pascal] Re: Firebird Connection documentation: suggestions? remarks?
On 19-11-2011 14:21, Reinier Olislagers wrote: Hi list, Please find attached my current version for the Interbase/Firebird connection documentation source. snip I have some doubts/questions: 1. Do I need to document inherited properties etc or will a documented parent unit's help filter down? (I suspectOf course, I'll figure that out when I get pdf generation working) Have uploaded documentation as patch 20735. Regards, Reinier ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Class reference doubt
in the following example The output is: cls class is TFoo TObj.create where I would expect: cls class is TFoo TObj.create TFoo.create ie the TFoo.constructor is not called, is this normal/expected?, The documentation does clarify the situation: http://www.freepascal.org/docs-html/ref/refse31.html Class reference types are used to create instances of a certain class, which is not yet known at compile time, but which is specified at run time. Essentially, a variable of a class reference type contains a pointer to the definition of the speficied class. This can be used to construct an instance of the class corresponding to the definition, or to check inheritance. Thanks. Jesus Reyes A. program test; {$mode ObjFpc}{$H+} type TObj = class public constructor create; end; TObjClass=class of TObj; TFoo = class(TObj) public constructor create; end; constructor TObj.Create; begin inherited create; WriteLn('TObj.create'); end; constructor TFoo.create; begin inherited Create; WriteLn('TFoo.Create'); end; var cls: TObjClass; obj: TObj; begin cls := TFoo; WriteLn('cls class is ',cls.ClassName); Obj := cls.Create; Obj.Free; end. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Class reference doubt
On 23 Nov 2011, at 22:48, Jesus Reyes wrote: in the following example The output is: cls class is TFoo TObj.create where I would expect: cls class is TFoo TObj.create TFoo.create ie the TFoo.constructor is not called, is this normal/expected? Yes. You have to use a virtual constructor if you wish to override in a child class, just like with regular methods and class methods. Jonas___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Generic syntax that compiles with FPC 2.4.4 but not with FPC 2.6.0-0.rc1
Regarding this issue: http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=20713 The following does not compile any more with FPC 2.6.0-0.rc1. --- generic TGen_T = class type public T_TArray = array of _T; var private w: T_TArray; public constructor Create(Value: _T); end; TSpecial = specialize TGeninteger; --- At line: T_TArray = array of _T; it says: unit1.pas(31,16) Fatal: Syntax error, : expected but = found It is either a regression bug in FPC 2.6.0 or a bug in FPC 2.4.4 that got fixed. Which one is it? Juha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: Generic syntax that compiles with FPC 2.4.4 but not with FPC 2.6.0-0.rc1
I tested FPC 2.6.0 on Linux and FPC 2.4.4 on Windows but it shouldn't matter in this case. Juha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Generic syntax that compiles with FPC 2.4.4 but not with FPC 2.6.0-0.rc1
On 23 Nov 2011, at 23:01, Juha Manninen wrote: The following does not compile any more with FPC 2.6.0-0.rc1. --- generic TGen_T = class type public T_TArray = array of _T; var private w: T_TArray; public constructor Create(Value: _T); end; TSpecial = specialize TGeninteger; --- At line: T_TArray = array of _T; it says: unit1.pas(31,16) Fatal: Syntax error, : expected but = found It is either a regression bug in FPC 2.6.0 or a bug in FPC 2.4.4 that got fixed. Which one is it? It's related to this: http://wiki.freepascal.org/FPC_New_Features_2.6.0#Better_support_for_Delphi-compatible_classes The syntax is now: type generic TGen_T = class public type T_TArray = array of _T; private var w: T_TArray; public constructor Create(Value: _T); end; TSpecial = specialize TGeninteger; I.e., type, var etc are now inside public/private/protected sections, rather than that you have public/private/protected sections inside type/var blocks (Delphi-compatible and more logical). It should be added to User_Changes_2.6.0 though. Jonas___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Generic syntax that compiles with FPC 2.4.4 but not with FPC 2.6.0-0.rc1
2011/11/24 Jonas Maebe jonas.ma...@elis.ugent.be The syntax is now: type generic TGen_T = class public type T_TArray = array of _T; private var w: T_TArray; public constructor Create(Value: _T); end; TSpecial = specialize TGeninteger; I.e., type, var etc are now inside public/private/protected sections, rather than that you have public/private/protected sections inside type/var blocks (Delphi-compatible and more logical). It should be added to User_Changes_2.6.0 though. Works. Thanks for the quick answer. Juha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Class reference doubt
On 23/11/2011 18:48, Jesus Reyes wrote: in the following example The output is: cls class is TFoo TObj.create where I would expect: cls class is TFoo TObj.create TFoo.create I also hit this problem recently Found that this is one limitation of fpc. Under newer delphi it's possible to get the expected behavior without forcing programmer to create a virtual constructor by using the new RTTI Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal