Re: [fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

2019-06-30 Thread Michael Van Canneyt
On Sun, 30 Jun 2019, Sven Barth via fpc-devel wrote: Am 30.06.2019 um 00:02 schrieb Martin Frb: However this works: === code begin === function GetFoo(AIndex: Integer; BIndex: Integer = 0): Integer; property Foo[AIndex: Integer; BIndex: Integer = 0]: Integer read GetFoo; Ouch What then

Re: [fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

2019-06-30 Thread Sven Barth via fpc-devel
Am 30.06.2019 um 00:02 schrieb Martin Frb: However this works: === code begin === function GetFoo(AIndex: Integer; BIndex: Integer = 0): Integer; property Foo[AIndex: Integer; BIndex: Integer = 0]: Integer read GetFoo; Ouch What then about   function GetFoo(AIndex: Integer = 0): Integer;  

Re: [fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

2019-06-29 Thread Martin Frb
On 29/06/2019 23:43, Sven Barth via fpc-devel wrote: Am 28.06.2019 um 10:39 schrieb Martin Frb: What does Delphi do with     property Foo[AIndex: Integer; BIndex: Integer = 0]: Integer read GetFoo; Because FPC rejects this one. (And IMHO rightfully so) Hope this madness can be avoided in

Re: [fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

2019-06-29 Thread Sven Barth via fpc-devel
Am 28.06.2019 um 10:39 schrieb Martin Frb: On 28/06/2019 07:39, Sven Barth via fpc-devel wrote: Am 27.06.2019 um 21:09 schrieb Martin:   { TFoo }   TFoo = class   private     function GetFoo(var AIndex: Integer): Integer;   public     property Foo[var AIndex: Integer]: Integer read GetFoo;  

Re: [fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

2019-06-28 Thread Sven Barth via fpc-devel
Ryan Joseph schrieb am Fr., 28. Juni 2019, 20:12: > > > > On Jun 28, 2019, at 1:39 AM, Sven Barth via fpc-devel < > fpc-devel@lists.freepascal.org> wrote: > > > > I just tested with Delphi and it works there as well. So contrary to > what we thought this does not seem to be a bug... > > I think

Re: [fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

2019-06-28 Thread Ryan Joseph
> On Jun 28, 2019, at 1:39 AM, Sven Barth via fpc-devel > wrote: > > I just tested with Delphi and it works there as well. So contrary to what we > thought this does not seem to be a bug... I think it’s still buggy. Why does this compile? I guess it would make sense if the property didn’t

Re: [fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

2019-06-28 Thread Martin Frb
On 28/06/2019 07:39, Sven Barth via fpc-devel wrote: Am 27.06.2019 um 21:09 schrieb Martin:   { TFoo }   TFoo = class   private     function GetFoo(var AIndex: Integer): Integer;   public     property Foo[var AIndex: Integer]: Integer read GetFoo;   end; I just tested with Delphi and it

Re: [fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

2019-06-27 Thread Sven Barth via fpc-devel
Am 27.06.2019 um 21:09 schrieb Martin: The below compiles, and writes 1 2 Are indexes to properties intentionally allowed to take "var param"? Btw it even compiles with an "out" param. program Project1; type   { TFoo }   TFoo = class   private     function GetFoo(var AIndex: Integer):

Re: [fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

2019-06-27 Thread Sven Barth via fpc-devel
Am 28.06.2019 um 00:00 schrieb Ryan Joseph: On Jun 27, 2019, at 5:57 PM, Sven Barth via fpc-devel wrote: If it's a bug (what I do indeed think of this and the other bug you mentioned) it's considered acceptable to break backwards compatibility. After all we wouldn't be able to fix

Re: [fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

2019-06-27 Thread Martin Frb
On 28/06/2019 00:09, Ben Grasset wrote: On Thu, Jun 27, 2019 at 4:12 PM Martin > wrote: Are indexes to properties intentionally allowed to take "var param"? Btw it even compiles with an "out" param. "Var" and "Out" seem bad, although I've always though that

Re: [fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

2019-06-27 Thread Ben Grasset
On Thu, Jun 27, 2019 at 4:12 PM Martin wrote: > Are indexes to properties intentionally allowed to take "var param"? > Btw it even compiles with an "out" param. > "Var" and "Out" seem bad, although I've always though that "Constref" *should* be allowed.

Re: [fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

2019-06-27 Thread Ryan Joseph
> On Jun 27, 2019, at 5:57 PM, Sven Barth via fpc-devel > wrote: > > If it's a bug (what I do indeed think of this and the other bug you > mentioned) it's considered acceptable to break backwards compatibility. After > all we wouldn't be able to fix essentially anything as some code out

Re: [fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

2019-06-27 Thread Sven Barth via fpc-devel
Ryan Joseph schrieb am Do., 27. Juni 2019, 23:50: > > > > On Jun 27, 2019, at 3:09 PM, Martin wrote: > > > > The below compiles, and writes > > 1 2 > > > > Are indexes to properties intentionally allowed to take "var param"? > > Btw it even compiles with an "out" param. > > That sounds like a

Re: [fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

2019-06-27 Thread Ryan Joseph
> On Jun 27, 2019, at 3:09 PM, Martin wrote: > > The below compiles, and writes > 1 2 > > Are indexes to properties intentionally allowed to take "var param"? > Btw it even compiles with an "out" param. That sounds like a bug or something that should be prevented. I just found out default

[fpc-devel] Is that supposed to work: property with "[var index: TFoo]" ?

2019-06-27 Thread Martin
The below compiles, and writes 1 2 Are indexes to properties intentionally allowed to take "var param"? Btw it even compiles with an "out" param. program Project1; type   { TFoo }   TFoo = class   private     function GetFoo(var AIndex: Integer): Integer;   public     property Foo[var