[fpc-devel] indexed property with default value for param?
Michael Van Canneyt
michael at freepascal.org
Thu Jun 11 16:00:58 CEST 2009
On Thu, 11 Jun 2009, Jonas Maebe wrote:
> 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
>>>> 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:
>>>> 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
> 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 anyway.
I would think it is a natural extension of procedural overloading ? An array
property is only a simplification of getter/setters...
That it is impossible to do for published properties is not abnormal either:
there are other kinds of properties that cannot be published. (records for
I'll file a separate bugreport with the request to allow property
overloading for non-published array properties if you think it is better.
(I do ;) )
More information about the fpc-devel