Re: [fpc-pascal] Constants in generics

2019-01-03 Thread Alexander Shishkin via fpc-pascal
03.01.2019 15:45, Mattias Gaertner via fpc-pascal пишет: On Thu, 3 Jan 2019 14:58:00 +0300 Alexander Shishkin via fpc-pascal wrote: [...] This is OK (both T and U are integer): generic TMyRecord1 = record end; That is inconsistent to normal Pascal arguments. Name[, Name ...][:type] Isn&#

Re: [fpc-pascal] Constants in generics

2019-01-03 Thread Alexander Shishkin via fpc-pascal
03.01.2019 6:32, Ryan Joseph пишет: On Jan 2, 2019, at 8:25 PM, Alexander Shishkin via fpc-pascal wrote: This is not consistent with constraints. Should be ";" after T. And what about following examples? The semicolon is only needed following a generic parameter which is c

Re: [fpc-pascal] Constants in generics

2019-01-02 Thread Alexander Shishkin via fpc-pascal
03.01.2019 4:29, Ryan Joseph пишет: type generic TMyRecord_Int = record end; This is not consistent with constraints. Should be ";" after T. And what about following examples? type generic TMyRecord1 = record end; type generic TMyRecord2 = record

Re: [fpc-pascal] Constants in generics

2019-01-02 Thread Alexander Shishkin via fpc-pascal
var data: array[0..U] of T; end; generic TList4 = class var data: array[0..U] of T; end; 03.01.2019 2:15, Sven Barth via fpc-pascal пишет: Am Mi., 2. Jan. 2019, 23:41 hat Alexander Shishkin via fpc-pascal <mailto:fpc-pascal@lists.freepascal.org>> geschrieben: 06.11.

Re: [fpc-pascal] Constants in generics

2019-01-02 Thread Alexander Shishkin via fpc-pascal
06.11.2018 10:13, Ryan Joseph пишет: program generic_constants; type generic TList = record list: array[0..U-1] of T; function capacity: integer; end; I`d like to see constant parameter to be constrained with type type generic TList =

Re: [fpc-pascal] Constant of 2D array

2012-09-11 Thread Alexander Shishkin
11.09.2012 16:51, Felipe Monteiro de Carvalho пишет: Hello, Can I write constants of a 2D array? I am trying to convert some C++ code which uses this ... so far I tryed: const number_return_map: array[0..7][0..7] of U8 = ( ( 15, 14, 13, 12, 11, 10, 9, 8 ), ( 14, 0, 1, 3, 6, 10, 10,

Re: [fpc-pascal] std::map equivalent?

2012-06-13 Thread Alexander Shishkin
12.06.2012 17:38, Xiangrong Fang пишет: Hi, Is there a std::map equivalent for free pascal? Thanks, Shannon -- ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal gmap.TMap from fcl

Re: [fpc-pascal] Re: asm statement

2012-06-12 Thread Alexander Shishkin
12.06.2012 23:23, Rainer Stratmann пишет: Am Tuesday 12 June 2012 18:44:20 schrieb leledumbo: What happens if there is only the end; statement without the used registers? The compiler couldn't save the values in the registers prior to the asm block. If they contain intermediate result, they m

Re: [fpc-pascal] buffered filestream

2012-06-10 Thread Alexander Shishkin
10.06.2012 20:20, Mattias Gaertner пишет: On Sun, 10 Jun 2012 19:08:40 +0400 Alexander Shishkin wrote: 10.06.2012 18:40, Mattias Gaertner пишет: I want to pass the stream to a binary reader, which skips big parts of the stream. It can seek backwards and the files can be several GB, so I

Re: [fpc-pascal] buffered filestream

2012-06-10 Thread Alexander Shishkin
10.06.2012 18:40, Mattias Gaertner пишет: I want to pass the stream to a binary reader, which skips big parts of the stream. It can seek backwards and the files can be several GB, so I need the int64 read/write/seek. Do you mean buffered random access (smth like disk access in DBMS)?

Re: [fpc-pascal] various ways of passing a class instance as a parameter

2011-11-17 Thread Alexander Shishkin
15.11.2011 14:00, Graeme Geldenhuys пишет: This one confused me a bit. I thought the whole object would be read-only, but in fact it is just the AClass instance pointer which cannot be modified. The properties of AClass are still read-write. Perhaps it will be good to add support for const

Re: [fpc-pascal] various ways of passing a class instance as a parameter

2011-11-15 Thread Alexander Shishkin
15.11.2011 13:33, Graeme Geldenhuys пишет: Hi, What exactly is the difference (if any) between the parameter modifier when you pass a class instance to a procedure? I your example there is no difference, except that "var" could be ~0.01% slower _

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-06 Thread Alexander Shishkin
06.11.2011 18:13, dmitry boyarintsev пишет: On Sun, Nov 6, 2011 at 8:00 AM, Alexander Shishkin wrote: OK, agreed, this is more readable than Delphi syntax. But ... 1) If we implement lamdas is FPC we will have to support Delphi syntax. Hi-jacking, the thread, and again should FPC chase

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-06 Thread Alexander Shishkin
06.11.2011 15:53, Florian Klämpfl пишет: Am 05.11.2011 22:58, schrieb Alexander Shishkin: 06.11.2011 1:46, Michael Van Canneyt пишет: On Sat, 5 Nov 2011, Bernd wrote: 2011/10/25: targethread.queue( procedure(targetobject:ttargetobject;a:integer;b:someobject;c:string) begin

Re: [fpc-pascal] Free Pascal 2.6.0rc1 released

2011-11-05 Thread Alexander Shishkin
06.11.2011 3:47, Luiz Americo Pereira Camara пишет: On 5/11/2011 20:27, Marco van de Voort wrote: Downloads are available at the FTP server at: ftp://freepascal.stack.nl/pub/fpc/beta/2.6.0-rc1/ Cant download 550 /pub/fpc/beta/2.6.0-rc1/: Permission denied. Luiz

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-05 Thread Alexander Shishkin
06.11.2011 1:46, Michael Van Canneyt пишет: On Sat, 5 Nov 2011, Bernd wrote: 2011/10/25 : targethread.queue( procedure(targetobject:ttargetobject;a:integer;b:someobject;c:string) begin targetobject.destinationprocedure(a,b,c); end; Note how common thi

Re: [fpc-pascal] Re: Delphi's anonymous functions in Free Pascal

2011-11-05 Thread Alexander Shishkin
05.11.2011 22:42, Bernd пишет: 2011/10/25: targethread.queue( procedure(targetobject:ttargetobject;a:integer;b:someobject;c:string) begin targetobject.destinationprocedure(a,b,c); end; Note how common this looks compared to the original. One point i

Re: [fpc-pascal] How are Assigned, Free, Nil and Destroy related?

2011-10-21 Thread Alexander Shishkin
22.10.2011 10:20, Felipe Monteiro de Carvalho пишет: I understand Assigned as being the same as<> nil, so Assigned(Object) = Object<> nil I vaguely remember that it could be safer in some corner case, but I don't remember ever meting that. Method pointers? __

Re: [fpc-pascal] Delphi's anonymous functions in Free Pascal

2011-10-21 Thread Alexander Shishkin
18.10.2011 0:53, Andrew Pennebaker пишет: Does Free Pascal have anonymous functions that you can pass around, e.g. to a sort(compare : function, arr : array) function? anonymous functions = closures = lambdas are part of functional paradigm. object pascal itself is not functional language. Bu

Re: [fpc-pascal] Delphi's anonymous functions in Free Pascal

2011-10-19 Thread Alexander Shishkin
19.10.2011 12:16, Sven Barth пишет: E.g. TIntegerFunc = reference to function: Integer; procedure SomeOtherProc(aFunc: TIntegerFunc); ... procedure Foo; var x: Integer; begin x := 42; SomeOtherProc(function: Integer; begin Result := x; end;); end; I haven't tested that, but from the descript