Re: [fpc-pascal] Firebird vs. SQLite vs. PosgreSQL
> I've read the Firebird webpage and installed it but I can't seem to > find documentation on how it compares to SQLite and PostgreSQL. My > high level understanding is that it sits somewhere it between but I'm > looking for more in depth comparisons on performance, data integrity > tests and maybe even some real world experience anecdotes (+ive and > -ive) on deployment, maintenance etc. For use with fpc you have to look at the available interfacing libraries - in most cases you should use some object-definitions covering the plain-C-language API. For short: * FirebirdSQL and PostgreSQL are both fully featured Client-Server databases. At Least FirebirdSQL does have an embedded mode to avoid server. * SQLite is an embedded library with less features and smaller in size. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Constants in generics
On 06/11/2018 08:13, Ryan Joseph wrote: I implemented a first draft of constants (integers) in generics. My reason was specifically that I wanted a way to add methods to static arrays and generic records is the only way to accomplish this AFAIK. If I fix this up will it be considered as a patch? I wanted to present the idea first before I spent any more time. Here’s what I has so far (on GitHub). Just for info, there already is a way to do this, though being able to do it direct would be nice. You can wrap any constants into an object (or advanced record). program Project1; {$mode objfpc}{$H+} uses Classes; type generic Foo = object class procedure test; end; Data = object const val = 1; end; var bar: specialize Foo; class procedure Foo.test; begin writeln(A.val); end; begin bar.test; readln; end. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Constants in generics
Does this trick also work for declaring arrays using "val"? BR, Denis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Dynamic array bug
On Wed, Nov 7, 2018 at 3:39 AM Ryan Joseph wrote: > Good to know. I reported this before and Sven said it was fixed in an > update (after another user had submitted the original patch). > > Are you able to get a := a + [4]; to work? I’m looking Sven’s old message > titled "Feature announcement: Dynamic array extensions” and he says + > operator now works. Yes, it works. But only on Delphi: a := a + [4]; writeln(a[3]); // prints 4 -- Silvio Clécio ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Dynamic array bug
> On Nov 7, 2018, at 9:31 PM, silvioprog wrote: > > Yes, it works. But only on Delphi: > That’s too bad, I don’t use Delphi mode. Should be in Objfpc mode also right? Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Dynamic array bug
On Wed, Nov 7, 2018 at 12:09 PM Ryan Joseph wrote: > > > On Nov 7, 2018, at 9:31 PM, silvioprog wrote: > > > > Yes, it works. But only on Delphi: > > > > That’s too bad, I don’t use Delphi mode. Should be in Objfpc mode also > right? Oops... I meant "in Delphi compiler". ^^' Anyway, it doesn't compile in FPC (tested in both delphi and objfpc modes). -- Silvio Clécio ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Dynamic array bug
> On Nov 8, 2018, at 8:35 AM, Ryan Joseph wrote: > > Do you want me to file a new bug report for := operators? I just filed a report just in case. https://bugs.freepascal.org/view.php?id=34526 Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Dynamic array bug
> On Nov 7, 2018, at 10:12 PM, silvioprog wrote: > > Anyway, it doesn't compile in FPC (tested in both delphi and objfpc modes). > I read the old thread and we need to add {$modeswitch arrayoperators} to make it work. a += [4] does work now. Also I found the thread where Sven said he fixed the "Incompatible types: got "Set Of Byte” bug in r39554 (https://bugs.freepascal.org/view.php?id=34021). It is indeed fixed but only for + operators. Do you want me to file a new bug report for := operators? Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Dynamic array bug
On Wed, Nov 7, 2018 at 11:06 PM Ryan Joseph wrote: > I read the old thread and we need to add {$modeswitch arrayoperators} to > make it work. a += [4] does work now. > > Also I found the thread where Sven said he fixed the "Incompatible types: > got "Set Of Byte” bug in r39554 ( > https://bugs.freepascal.org/view.php?id=34021). It is indeed fixed but > only for + operators. > > Do you want me to file a new bug report for := operators? You can temporary solve it by specializing a generic array: program project1; {$mode objfpc}{$H+} {$modeswitch advancedrecords} {$modeswitch arrayoperators} uses sysutils; type TIntArray = specialize TArray; TMyRec = record a: TIntArray; class operator := (right: TIntArray): TMyRec; end; class operator TMyRec.:= (right: TIntArray): TMyRec; begin result.a := right; end; var r: TMyRec; a: TIntArray; begin r := specialize TArray.Create(1, 2, 3); a := [1, 2, 3]; a += [4]; end. -- Silvio Clécio ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Dynamic array bug
On Thu, Nov 8, 2018 at 1:13 AM silvioprog wrote: > On Wed, Nov 7, 2018 at 11:06 PM Ryan Joseph > wrote: > >> I read the old thread and we need to add {$modeswitch arrayoperators} to >> make it work. a += [4] does work now. >> >> Also I found the thread where Sven said he fixed the "Incompatible types: >> got "Set Of Byte” bug in r39554 ( >> https://bugs.freepascal.org/view.php?id=34021). It is indeed fixed but >> only for + operators. >> >> Do you want me to file a new bug report for := operators? > > > You can temporary solve it by specializing a generic array: > ... or forcing the compiler to get the correct type by cast: type TIntArray = array of integer; ... var r: TMyRec; begin r := TIntArray([1, 2, 3]); ... -- Silvio Clécio ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal