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

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Jun 11 15:12:37 CEST 2009

On 11 Jun 2009, at 14:44, Michael Van Canneyt wrote:

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

Other arguments are also mentioned in the bug report (including about  
only allowing it for non-published properties). The fact that Delphi  
allows it is obviously a strong argument in favour of allowing it  


More information about the fpc-devel mailing list