Re: [fpc-pascal] Framework for Objects Serialization / Deserialization

2016-03-31 Thread Michael Van Canneyt
On Fri, 1 Apr 2016, Mazola Winstrol wrote: Hello list, Is there a fpc framework for or some standard to serialize / deserialize classes and other custom types? At least two units offer the base for such functionality: jsonrtti (fcl-json) and restbase (fcl-web) And obviously any TComponent

[fpc-pascal] Framework for Objects Serialization / Deserialization

2016-03-31 Thread Mazola Winstrol
Hello list, Is there a fpc framework for or some standard to serialize / deserialize classes and other custom types? Regards ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread Sven Barth
Am 31.03.2016 17:28 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > On 2016-03-31 16:06, Michael Van Canneyt wrote: > > > I am guessing it comes from C++/Java/C#, which AFAIK do not have > > the 'initialization' section. But that's just a guess. > > [my personal opinion - feel fre

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread Michael Van Canneyt
On Thu, 31 Mar 2016, Maciej Izak wrote: 2016-03-31 17:06 GMT+02:00 Michael Van Canneyt : I imagine so, yes. It is one of the reasons why I don't really see the usefulness of this construct, except that it looks OOP-ish. It is mostly for initialization "class var" related stuff inside rec

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread Graeme Geldenhuys
On 2016-03-31 16:46, Dmitry Boyarintsev wrote: > One could use an alternative approach and have "binding" units. > The unit would consist of initialization section only, that does the > necessary binding code. tiOPF's TestSuite project has a tiTestDependencies.pas unit which primarily consists of

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread Michael Van Canneyt
On Thu, 31 Mar 2016, Dmitry Boyarintsev wrote: On Thu, Mar 31, 2016 at 11:28 AM, Graeme Geldenhuys < mailingli...@geldenhuys.co.uk> wrote: On 2016-03-31 16:06, Michael Van Canneyt wrote: I usually have a 'Start Application' kind of routine where I register all the necessary things, link thi

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread Maciej Izak
2016-03-31 17:06 GMT+02:00 Michael Van Canneyt : > I imagine so, yes. > > It is one of the reasons why I don't really see the usefulness of this > construct, except that it looks OOP-ish. > > It is mostly for initialization "class var" related stuff inside records and classes. Very usefully especi

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread Dmitry Boyarintsev
On Thu, Mar 31, 2016 at 11:28 AM, Graeme Geldenhuys < mailingli...@geldenhuys.co.uk> wrote: > On 2016-03-31 16:06, Michael Van Canneyt wrote: > > I usually have a 'Start Application' kind of routine where I register all > > the necessary things, link things together (needed if you follow 'loosely

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread Vojtěch Čihák
I meant Delphi optimization but I'm mistaking since they have it documented.   B. __ Od: silvioprog Komu: "FPC-Pascal users discussions" Datum: 31.03.2016 16:17 Předmět: Re: [fpc-pascal] Class constructor called unconditionally On Th

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread Graeme Geldenhuys
On 2016-03-31 16:06, Michael Van Canneyt wrote: > I am guessing it comes from C++/Java/C#, which AFAIK do not have > the 'initialization' section. But that's just a guess. [my personal opinion - feel free to ignore this paragraph] I hate such "features" pulled in from other languages, when Objec

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread Michael Van Canneyt
On Thu, 31 Mar 2016, silvioprog wrote: On Thu, Mar 31, 2016 at 11:28 AM, Michael Van Canneyt < mich...@freepascal.org> wrote: [...] I suspect the problem is not in the mode, but in detecting whether a class is used or not in a program. It becomes very complicated when you use e.g. run-time p

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread silvioprog
On Thu, Mar 31, 2016 at 11:28 AM, Michael Van Canneyt < mich...@freepascal.org> wrote: [...] > I suspect the problem is not in the mode, but in detecting whether a class > is used > or not in a program. It becomes very complicated when you use e.g. > run-time packages. > Hm... so FPC class constr

Re: [fpc-pascal] PDF generator, try 2

2016-03-31 Thread Ralf Quint
On 3/31/2016 7:02 AM, Michael Van Canneyt wrote: Hello In revision 33401 of FPC subversion, a lot of fixes have been committed for Font handling in the PDF generator: e.g. Unicode fonts should now render correctly. The test program generates the following PDF: http://www.freepascal.org/~mi

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread Michael Van Canneyt
On Thu, 31 Mar 2016, silvioprog wrote: On Thu, Mar 31, 2016 at 10:58 AM, Vojtěch Čihák wrote: IMO compilers should be dogmatic otherwise one cannot rely on them. This looks to me like advocating wrong optimization. Blaazen Thanks for reply Vojtěch, but are you referring to Delphi or F

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread silvioprog
On Thu, Mar 31, 2016 at 10:58 AM, Vojtěch Čihák wrote: > IMO compilers should be dogmatic otherwise one cannot rely on them. This > looks to me like advocating wrong optimization. > > > > Blaazen > Thanks for reply Vojtěch, but are you referring to Delphi or FPC optimization? I think that FPC s

[fpc-pascal] PDF generator, try 2

2016-03-31 Thread Michael Van Canneyt
Hello In revision 33401 of FPC subversion, a lot of fixes have been committed for Font handling in the PDF generator: e.g. Unicode fonts should now render correctly. The test program generates the following PDF: http://www.freepascal.org/~michael/test.pdf Page 1 looks as follows on my system:

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread Vojtěch Čihák
IMO compilers should be dogmatic otherwise one cannot rely on them. This looks to me like advocating wrong optimization.   Blaazen __ Od: silvioprog Komu: "FPC-Pascal users discussions" Datum: 31.03.2016 15:33 Předmět: [fpc-pascal] Cl

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread silvioprog
On Thu, Mar 31, 2016 at 10:49 AM, Sven Barth wrote: > Am 31.03.2016 15:33 schrieb "silvioprog" : > > After read this explanations, is there some compiler option to make FPC > with this same Delphi behaviour? I'm using MODE DELPHI. > > No, there is not. Currently class constructors (and destructor

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread Sven Barth
Am 31.03.2016 15:33 schrieb "silvioprog" : > After read this explanations, is there some compiler option to make FPC with this same Delphi behaviour? I'm using MODE DELPHI. No, there is not. Currently class constructors (and destructors) are called always. Regards, Sven __

[fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread silvioprog
Hello, First, take a look at this small project: === code === program Project1; {$IFDEF FPC} {$MODE DELPHI} {$ENDIF} {$IFDEF MSWINDOWS} {$APPTYPE CONSOLE} {$ENDIF} type TFoo = class public class constructor Create; end; class constructor TFoo.Create; begin Writeln('TFoo.

Re: [fpc-pascal] Default source encoding

2016-03-31 Thread Mattias Gaertner
On Thu, 31 Mar 2016 14:38:35 +0200 Jonas Maebe wrote: >[...] > There are two separate things: > a) the code page that the compiler uses *if* it has to convert a string > at compile time to a different code page (e.g. because you assign the > string constant to an ansistring(1251), or to a unico

Re: [fpc-pascal] Default source encoding

2016-03-31 Thread Michael Van Canneyt
On Thu, 31 Mar 2016, Mattias Gaertner wrote: On Thu, 31 Mar 2016 14:14:14 +0200 (CEST) Michael Van Canneyt wrote: [...] > What happens on a Russian system cp1251 with a cp1251 AnsiString > literal? > > writeln('Привет'); Careful, writing may change the codepage. Yes, I know. That's why i

Re: [fpc-pascal] Default source encoding

2016-03-31 Thread Jonas Maebe
On 31/03/16 14:12, Mattias Gaertner wrote: On Thu, 31 Mar 2016 13:52:54 +0200 Jonas Maebe wrote: On 31/03/16 13:46, Mattias Gaertner wrote: According to http://wiki.freepascal.org/index.php?title=FPC_Unicode_support#String_constants "the constant strings are assumed to have code page 28591

Re: [fpc-pascal] Default source encoding

2016-03-31 Thread Mattias Gaertner
On Thu, 31 Mar 2016 14:14:14 +0200 (CEST) Michael Van Canneyt wrote: >[...] > > What happens on a Russian system cp1251 with a cp1251 AnsiString > > literal? > > > > writeln('Привет'); > > Careful, writing may change the codepage. Yes, I know. That's why it is important that the compiler uses t

Re: [fpc-pascal] Default source encoding

2016-03-31 Thread Michael Van Canneyt
On Thu, 31 Mar 2016, Mattias Gaertner wrote: On Thu, 31 Mar 2016 13:52:54 +0200 Jonas Maebe wrote: On 31/03/16 13:46, Mattias Gaertner wrote: > According to > http://wiki.freepascal.org/index.php?title=FPC_Unicode_support#String_constants > > "the constant strings are assumed to have code

Re: [fpc-pascal] Default source encoding

2016-03-31 Thread Mattias Gaertner
On Thu, 31 Mar 2016 13:52:54 +0200 Jonas Maebe wrote: > On 31/03/16 13:46, Mattias Gaertner wrote: > > > According to > > http://wiki.freepascal.org/index.php?title=FPC_Unicode_support#String_constants > > > > "the constant strings are assumed to have code page 28591 (ISO 8859-1 > > Latin 1; Wes

Re: [fpc-pascal] Default source encoding

2016-03-31 Thread Jonas Maebe
On 31/03/16 13:46, Mattias Gaertner wrote: According to http://wiki.freepascal.org/index.php?title=FPC_Unicode_support#String_constants "the constant strings are assumed to have code page 28591 (ISO 8859-1 Latin 1; Western European)." Is this true? Yes. Or is the compiler using the system

[fpc-pascal] Default source encoding

2016-03-31 Thread Mattias Gaertner
Hi, According to http://wiki.freepascal.org/index.php?title=FPC_Unicode_support#String_constants "the constant strings are assumed to have code page 28591 (ISO 8859-1 Latin 1; Western European)." Is this true? Or is the compiler using the system codepage? It was added in this revision by Jona