[fpc-devel] [] property overloads
Michael Van Canneyt
michael at freepascal.org
Sat Jul 6 18:14:06 CEST 2019
On Sat, 6 Jul 2019, Ryan Joseph wrote:
> Sorry to ask again but has it been decided that this code should *not* be allowed for ObjFPC mode? I’ll file a bug report right now if so. It will break existing code but when my patch gets applied it can be added back using proper properties.
>
> function GetValue(k0: variant): TJSON; overload;
> function GetValue(k0,k1: variant): TJSON; overload;
> function GetValue(k0,k1,k2: variant): TJSON; overload;
> function GetValue(k0,k1,k2,k3: variant): TJSON; overload;
> property Values[key: variant]: TJSON read GetValue; default;
Why should this declaration not be allowed ?
Only the first GetValue() should be called, of course.
i.e. statement 1:
A:=Values[MyVariant]
must work
but e.g. statement 2:
A:=Values[MyVariant1,MyVariant2]
must not work.
Only if overloaded array properties are allowed
property Values[key: variant]: TJSON read GetValue; default;
property Values[key1,key2: variant]: TJSON read GetValue; default;
may the second statement be accepted.
Michael.
More information about the fpc-devel
mailing list