[fpc-pascal] try..finally vs interfaces performance

2016-04-14 Thread Mazola Winstrol
Recently i did some maintenance in a code of a colleague. I realized that he designed several classes with interface support so he do not need to protect the code blocks with try..finally to ensure that the instances are released from memory. Theoretically, which solution has higher performance? T

Re: [fpc-pascal] Initialization in Shared Libraries

2016-04-14 Thread Mazola Winstrol
2016-04-13 16:48 GMT-03:00 Sven Barth : > > Yes and mostly yes. The finalization sections might not be called in the > context of the same thread as the initialization sections, because if > the thread that does the last unload of the library (if it is > dynamically loaded) then it's called in tha

Re: [fpc-pascal] Initialization in Shared Libraries

2016-04-13 Thread Mazola Winstrol
2016-04-13 15:56 GMT-03:00 Jonas Maebe : > > And hence you can just initialise those variables in the initialization > section of the library and finalize them (if necessary) in the finalization > section of the library. > > Thanks! Can i use class constructors in shared libraries? Does unit's in

Re: [fpc-pascal] Initialization in Shared Libraries

2016-04-13 Thread Mazola Winstrol
2016-04-13 15:52 GMT-03:00 Michael Van Canneyt : > > > On Wed, 13 Apr 2016, Mazola Winstrol wrote: > > Hello list, >> >> I writting a cross-platform shared library (.dll, .so). I need to >> initialize some global variables. >> >> As the free pascal d

[fpc-pascal] Initialization in Shared Libraries

2016-04-13 Thread Mazola Winstrol
Hello list, I writting a cross-platform shared library (.dll, .so). I need to initialize some global variables. As the free pascal doesn't support library events (PROCESS_ATTACH, PROCESS_DETACH), what is the correct to way to do this? best ragrds ___ f

Re: [fpc-pascal] Implicit Operator Overloading

2016-04-10 Thread Mazola Winstrol
2016-03-07 3:53 GMT-03:00 Sven Barth : > Am 06.03.2016 22:09 schrieb "Mazola Winstrol" : > > > > Hello, > > > > Fpc: 3.0 > > > > Should the compiler to allow the definition of two operator overloading > with the same parameters and d

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

2016-04-01 Thread Mazola Winstrol
2016-04-01 3:46 GMT-03:00 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 tw

[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] Fpc 3.0 Bug: type specialization and operator overload

2016-03-19 Thread Mazola Winstrol
2016-03-12 21:45 GMT-03:00 Sven Barth : > It does not treat them the same, it simply picks the wrong one (as in > "doesn't correctly respect the unit qualifier"). You should see a different > (yet no less wrong) behavior if you turn around the units in the > uses-clause. > > Please report. > > Reg

Re: [fpc-pascal] Primitive Record Wrappers

2016-03-19 Thread Mazola Winstrol
2016-03-11 0:15 GMT-03:00 silvioprog : > On Sun, Mar 6, 2016 at 7:21 PM, Mazola Winstrol > wrote: > [...] > >> Please see the code in attachments and send your suggestions / remarks. >> > > Thanks for share. > > How do I use the the NullableTypes.String u

[fpc-pascal] Fpc 3.0 Bug: type specialization and operator overload

2016-03-12 Thread Mazola Winstrol
Hello, Fpc version: 3.0 (the one provided by Lazarus). Please confirm if this is a bug regarding operator overloading and type specialization. It is a quite difficult to explain, but i will try. Consider this unit === CODE === unit MyRecordDefinitionA; {$mode delphi} interface type TMyRe

Re: [fpc-pascal] Fpc Bug 3.0: Generics and Operator Overloading

2016-03-06 Thread Mazola Winstrol
2016-03-06 19:48 GMT-03:00 Mazola Winstrol : > Done. Issued as #0029792. <http://bugs.freepascal.org/view.php?id=29387> > > The link is wrong. =) Issued here: #0029792 <http://bugs.freepascal.org/view.php?id=29792> ___ fpc-pa

Re: [fpc-pascal] Fpc Bug 3.0: Generics and Operator Overloading

2016-03-06 Thread Mazola Winstrol
2016-03-06 17:45 GMT-03:00 Sven Barth : > Yes, that's a bug. Please report. > > Regards, > Sven > > Done. Issued as #0029792. Regards ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists

[fpc-pascal] Implicit Operator Overloading

2016-03-06 Thread Mazola Winstrol
Hello, Fpc: 3.0 Should the compiler to allow the definition of two operator overloading with the same parameters and diferent result types? e.g: code TMyRecord record class operator Implicit(A: TMyRecord): Real; class operator Implicit(A: TMyRecord): Integer; end;

[fpc-pascal] Fpc Bug: Type specialization with Generics and Operator Overloading in Diferent Units

2016-03-06 Thread Mazola Winstrol
Hello, Fpc version: 3.0 (the same included with lazarus 1.6). Please confirm if it is a bug: If i declare a generic record with overloaded add operation, i need to specialize the type in the same unit for the compiler recognize the overloading. === Code === unit MyRecordDefinition; {$mode de

[fpc-pascal] Fpc Bug 3.0: Generics and Operator Overloading

2016-03-06 Thread Mazola Winstrol
Hello, Fpc version: 3.0 (the one included with Lazarus 1.6). Please confirm if it is a bug: it seems the compiler doesn't handle operator overloading properly when using generic record with local specializations. = Code = unit Test; {$mode delphi} type TMyRecord = record class

Re: [fpc-pascal] Primitive Record Wrappers

2016-03-03 Thread Mazola Winstrol
2016-03-02 23:12 GMT-03:00 silvioprog : > On Tue, Mar 1, 2016 at 12:08 AM, Mazola Winstrol > wrote: > [...] >> >> I apologize, it works. >> > > Do you have plan to share it in some place like Github, Lazarus-CCR or as > Lazarus generics demo? Just a idea, bec

Re: [fpc-pascal] Primitive Record Wrappers

2016-03-01 Thread Mazola Winstrol
2016-03-01 10:07 GMT-03:00 Constantine Yannakopoulos : > > The only solution I have found is to implement ALL operators for > TNullableType by defining a generic interface INullableOperatiors > that contains methods for all operators, then implement for each type by > means of manual interface imp

Re: [fpc-pascal] Primitive Record Wrappers

2016-03-01 Thread Mazola Winstrol
2016-03-01 1:48 GMT-03:00 : > On 02/29/2016 10:08 PM, Mazola Winstrol wrote: > >> There is a problem in my design. The code won't compile if i try to >> specialize with a type which doesn'y supports arithmetic operators e.g >> String >> types. >> >

Re: [fpc-pascal] Primitive Record Wrappers

2016-03-01 Thread Mazola Winstrol
2016-03-01 9:13 GMT-03:00 Sven Barth : > Am 01.03.2016 04:08 schrieb "Mazola Winstrol" : > > Is there any way to overcome this? Is there any way to tell the compiler > to ignore some operators depending on the specialization type? > > No, there is not. Better not

Re: [fpc-pascal] Primitive Record Wrappers

2016-02-29 Thread Mazola Winstrol
2016-02-29 13:16 GMT-03:00 Sven Barth : > Am 29.02.2016 16:13 schrieb "Mazola Winstrol" : > > > > I have noticed that, by using generics, we can't overload arithmetic > operators. > > > > E.g.: > > > > ... > > class operato

Re: [fpc-pascal] Primitive Record Wrappers

2016-02-29 Thread Mazola Winstrol
I have noticed that, by using generics, we can't overload arithmetic operators. E.g.: ... class operator Negative(A: TNullableType): T; ... class operator TNullableType.Negative(A: TNullableType): T; begin Result := -1 * A; end; wouldn't compile with the error "Operator not applicable

Re: [fpc-pascal] Primitive Record Wrappers

2016-02-29 Thread Mazola Winstrol
2016-02-27 14:58 GMT-03:00 silvioprog : > > $MODE DELPHI implies {$H ON} > , so so you > should remove the {$H+}. > > Thanks for the tip! i will remove for the next version. ___ fpc-pascal maillist

Re: [fpc-pascal] Primitive Record Wrappers

2016-02-27 Thread Mazola Winstrol
2016-02-27 0:49 GMT-03:00 Dmitry Boyarintsev : > On Fri, Feb 26, 2016 at 10:38 PM, Mazola Winstrol > wrote: > >> In the code bellow, the generic type TNullableTyple is implemented (and >> incomplete for now). >> > How to reset TNullableType to Null value? HasValu

Re: [fpc-pascal] Primitive Record Wrappers

2016-02-27 Thread Mazola Winstrol
I've implemented a new version. For this version i created a mock class to use with FHasValue (the previous implementation uses a hack to the interface internal layout). unit NullableTypes; {$mode delphi}{$H+} interface type { TMockInterfacedObject } TMockInterfacedObject = class(TObject

Re: [fpc-pascal] Primitive Record Wrappers

2016-02-26 Thread Mazola Winstrol
Hello, In the code bellow, the generic type TNullableTyple is implemented (and incomplete for now). Is there any possibility of "nullable types" be added to RTL or anyother fpc provided package? unit NullableTypes; {$mode delphi}{$H+} interface type { TNullable } TNullable = record s

Re: [fpc-pascal] Variable Initialization Questions

2016-02-21 Thread Mazola Winstrol
2016-02-18 18:38 GMT-02:00 Jonas Maebe : > Mazola Winstrol wrote: > >> Just to clarify: if i have a record type with a pointer field, this >> field will always zeroed? >> > > No. As mentioned, all global variables are always zeroed. The type doesn't > ma

Re: [fpc-pascal] Primitive Record Wrappers

2016-02-20 Thread Mazola Winstrol
2016-02-20 3:24 GMT-02:00 Michalis Kamburelis : > The major problem there is that it's difficult to force it to be > always initialized with zeroes. Currently, a non-global variable of > unmanaged type can always be filled with memory garbage, as explained > in other thread. The trick in > http://

Re: [fpc-pascal] Variable Initialization Questions

2016-02-18 Thread Mazola Winstrol
2016-02-17 15:16 GMT-02:00 Jonas Maebe : > Jonas Maebe wrote: > >> 3 - When i declare a pointer as a global variable or as a member of a >>> record, can i assume that its initial value is nil? >>> >> >> No. >> > > Correction: all global variables are always zeroed, so that includes > pointers, rec

Re: [fpc-pascal] Primitive Record Wrappers

2016-02-18 Thread Mazola Winstrol
Em 18/02/2016 10:12, "Marco van de Voort" escreveu: > > In our previous episode, Mazola Winstrol said: > >end; > > > > > > Suppose that this class represent data of the Person table in a sql > > database. Suppose that there is records wher

Re: [fpc-pascal] Primitive Record Wrappers

2016-02-18 Thread Mazola Winstrol
2016-02-18 8:00 GMT-02:00 leledumbo : > > What do you think about it? Is there any other solution? > > There's a reason why > http://www.freepascal.org/docs-html/3.0.0/fcl/db/tfield.isnull.html is > invented > > You didnt understand my point. Design classes coupled with DB framework is not a solut

[fpc-pascal] Primitive Record Wrappers

2016-02-17 Thread Mazola Winstrol
Hello list, In some situations, would be very interesting to determine whether the value of a primitive variable is initialized or not. For example, fields in database records can contain null values. By implementing an ORM, it would be interesting to represent these null values in the properties

Re: [fpc-pascal] Variable Initialization Questions

2016-02-17 Thread Mazola Winstrol
2016-02-17 14:58 GMT-02:00 Jonas Maebe : > Mazola Winstrol wrote: > >> 1 - Does the compiler automatically initialize all class fields when a >> new instance is created? >> > > They're called instance fields, and yes, they are zeroed. Class fields are > fiel

[fpc-pascal] Variable Initialization Questions

2016-02-17 Thread Mazola Winstrol
Hello List, After googled and searching in the documentation, http://free-pascal-general.1045716.n5.nabble.com/does-Advanced-Record-constructor-automatically-zero-all-the-memory-space-of-that-record-td5716755.html http://www.freepascal.org/docs-html/ref/refse23.html i still have doubts about var

Re: [fpc-pascal] IfThen() intrinsic removed

2016-02-04 Thread Mazola Winstrol
2016-02-04 19:13 GMT-02:00 Felipe Monteiro de Carvalho < felipemonteiro.carva...@gmail.com>: > On Thu, Feb 4, 2016 at 7:03 PM, Mazola Winstrol > wrote: > > Lets wait for the Delphi implementation so, we will not start a new > flame. > > You mean like "w

Re: [fpc-pascal] IfThen() intrinsic removed

2016-02-04 Thread Mazola Winstrol
2016-02-04 18:41 GMT-02:00 Felipe Monteiro de Carvalho < felipemonteiro.carva...@gmail.com>: > Disappointed :( > > Why was it done? I thought that pretty much everyone was in favor? > > Due to the fact that we like flame, flame and flame > It isn't very pascalish, that's true, but we could imple

[fpc-pascal] FastCGI Threaded Mode

2015-12-04 Thread Mazola Winstrol
Hello, The fpc's FastCGI supports threaded mode? Regards ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FPC 3.0.0-rc2 release

2015-10-22 Thread Mazola Winstrol
I'm about to start a new project. Do you recommend to use the release candidate version or the stable 2.6.4? Regards ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] XML Canonicalization Support

2015-10-16 Thread Mazola Winstrol
2015-10-16 15:19 GMT-03:00 Dariusz Mazur : > I've do one > > https://github.com/darekm/xades4fpc/blob/master/xmlc14n.pas > > > -- > Darek > > Very good news! Thanks a lot for the contribution! What is the stability of the implementation? ___ fpc-pascal

[fpc-pascal] XML Canonicalization Support

2015-10-16 Thread Mazola Winstrol
Hello, Does the fcl-xml package supports xml canonicalization? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Automatic Reference Counting Classes

2015-07-18 Thread Mazola Winstrol
Hello, Sometime ago Sven have reported to the list he was working in a proof of concept mechanism to implement ARC in FPC, a feature similar to the Objective-C's ARC. What's the current status of this work? Is it planned to be released in some futture release of FPC (e.g 3.2)? Best regards _