On Thu, 11 Jun 2009, Jonas Maebe wrote:


On 11 Jun 2009, at 14:14, Martin Friebe wrote:

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?

It won't: http://bugs.freepascal.org/view.php?id=12737 (that feature request was about having getters/setters with the same name, but the core problem is having multiple properties with the same name).

As far as I know, delphi 2005 and up allow the problem in 12737 for 
non-published properties.
Since array properties cannot be published anyway, the argument with RTTI is 
void ?

(which doesn't mean there are no other arguments to prevent it's implementation)

Michael.
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to