Michael Van Canneyt wrote:
On Wed, 10 Jun 2009, Martin wrote:
However the follwing Syntax compiles fine:
function GetFoo(Bar: integer; XY: Boolean = True): Integer;
property Foo[Bar: integer; XY: Boolean] read GetFoo;
a := Object.Foo[1];

But:
Is that supposed to work?

No, it is not. It is a compiler bug. Could you please create a bug report?
Done.

However it would be nice to have a feature like

   property Foo[Index: Integer]: Integer  write SetFoo  read GetFoo;
property Foo[Index: Integer; Ask: Boolean]: Integer write SetFooAsk read GetFooAsk;

The must have different Method Names, because the Setters(write SetFoo) last argument is the Value, so it' can not have a optional Ask element: procedure WrongSetFoo(Index: Integer; Ask: Boolean= True; AValue: Integer); But with different Setter/Getters that would not be a problem. In fact they can have the same name, if they are overloaded.

Any idea if such a feature would have a chance?

Best Regards
Martin


_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to