[fpc-devel] indexed property with default value for param?

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Jun 11 14:27:45 CEST 2009


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).


Jonas



More information about the fpc-devel mailing list