Re: [fpc-pascal] Constants in generics

2019-01-02 Thread denisgolovan
Hi, allCould someone confirm this functionality is merged into trunk? I mean constants in generics.29.11.2018, 05:24, "Ryan Joseph" : On Nov 29, 2018, at 5:15 AM, Sven Barth via fpc-pascal wrote: Looks better. The next thing to nuke is the tgenericparamdef. The par

Re: [fpc-pascal] Fixes 3.2: make all fails

2019-01-02 Thread Bart
On Tue, Jan 1, 2019 at 12:27 PM Marco van de Voort wrote: > If h2pas isn't modified (recently (check svn log), it is probably that > the timestamps somehow got messed up, and h2pas.pas is now older > h2pas.y. This sometimes happened to me, specially when using atypical > filesystems. (like e.g. b

Re: [fpc-pascal] Constants in generics

2019-01-02 Thread Sven Barth via fpc-pascal
Am Mi., 2. Jan. 2019, 11:20 hat denisgolovan geschrieben: > Hi, all > > Could someone confirm this functionality is merged into trunk? I mean > constants in generics. > I can confirm that it is not integrated in trunk. Regards, Sven ___ fpc-pascal mai

Re: [fpc-pascal] Constants in generics

2019-01-02 Thread denisgolovan
Well, I'll wait then.That's definitely nice to have feature.02.01.2019, 16:33, "Sven Barth via fpc-pascal" :Am Mi., 2. Jan. 2019, 11:20 hat denisgolovan geschrieben:Hi, allCould someone confirm this functionality is merged into trunk? I mean constants in generics.I can conf

Re: [fpc-pascal] SetLength warnings - request

2019-01-02 Thread Benito van der Zander
Hi, The current FPC trunk issues only a hint for the SetLength(). Then it is a bullshit hint  ("bullshint") 1) Dynamic arrays are initialised with nil, but that is an implementation detail (required by the fact that they are reference counted: if they would contain random data, that

Re: [fpc-pascal] SetLength warnings - request

2019-01-02 Thread Sven Barth via fpc-pascal
Am Mi., 2. Jan. 2019, 17:05 hat Benito van der Zander geschrieben: > The non-initialization of 'Result' has bitten me more than once in Delphi. > > > Me, too. Usually the solution was to add a call to SetLength. > > That makes the bullshit hints especially bad. > Even in Delphi situations can oc

Re: [fpc-pascal] SetLength warnings - request

2019-01-02 Thread Martin Frb
On 29/12/2018 22:35, Jonas Maebe wrote: 1) Dynamic arrays are initialised with nil, but that is an implementation detail (required by the fact that they are reference counted: if they would contain random data, that would cause crashes) Is it? Because according to https://www.freepascal.org

Re: [fpc-pascal] SetLength warnings - request

2019-01-02 Thread Martok
Am 02.01.2019 um 17:23 schrieb Sven Barth via fpc-pascal: > Even in Delphi situations can occur where a dynamic array Result variable is > non-Nil already upon entry and then SetLength will simply manipulate that > preexisting array instead of working on a new array. In most cases that > probably

Re: [fpc-pascal] SetLength warnings - request

2019-01-02 Thread Jonas Maebe
On 02/01/19 18:31, Martok wrote: Am 02.01.2019 um 17:23 schrieb Sven Barth via fpc-pascal: Even in Delphi situations can occur where a dynamic array Result variable is non-Nil already upon entry and then SetLength will simply manipulate that preexisting array instead of working on a new array. I

Re: [fpc-pascal] SetLength warnings - request

2019-01-02 Thread Jonas Maebe
On 02/01/19 17:05, Benito van der Zander wrote: 1) Dynamic arrays are initialised with nil, but that is an implementation detail (required by the fact that they are reference counted: if they would contain random data, that would cause crashes) If there ever is a fpc version that does not ini

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] inlining functions

2019-01-02 Thread Benito van der Zander
Hi, procedure TStrBuilder.append(const s: RawByteString); begin append(pchar(pointer(s)), length(s)); //inlinetest.pas(24,3) Note: Call to subroutine "procedure TStrBuilder.append(const p:PChar;const l:Int64);" marked as inline is not inlined end; this seems to help procedure TStrBuilder.a

Re: [fpc-pascal] Constants in generics

2019-01-02 Thread Sven Barth via fpc-pascal
Am Mi., 2. Jan. 2019, 23:41 hat Alexander Shishkin via fpc-pascal < fpc-pascal@lists.freepascal.org> geschrieben: > 06.11.2018 10:13, Ryan Joseph пишет: > > > > program generic_constants; > > > > type > > generic TList = record > > list: array[0..U-1] of T; > > fu

Re: [fpc-pascal] Constants in generics

2019-01-02 Thread Alexander Shishkin via fpc-pascal
Thanks, now I`ve lost is a discussion again. What is the decision about syntax? Is "const" prefix and/or ": type" suffix required? generic TList1 = class var data: array[0..U] of T; end; generic TList2 = class var data: array[0..U] of T; end; generic TLis3 = class var data: array[0..U]

Re: [fpc-pascal] Constants in generics

2019-01-02 Thread Ryan Joseph
> On Jan 2, 2019, at 3:13 PM, Alexander Shishkin via fpc-pascal > wrote: > > I`d like to see constant parameter to be constrained with type > > type > generic TList = record > list: array[0..U-1] of T; > function capacity: integer; > end; This is the s

Re: [fpc-pascal] Constants in generics

2019-01-02 Thread Ryan Joseph
> On Jan 2, 2019, at 5:52 PM, Alexander Shishkin via fpc-pascal > wrote: > > Thanks, now I`ve lost is a discussion again. What is the decision about > syntax? Is "const" prefix and/or ": type" suffix required? const is required but the type is not. Here’s a test for all the const types supp

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 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 constrained. This was the normal behavio