View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0012737||FPC||Compiler||public||2008-12-01 12:37||2009-12-15 11:58|
|Reporter||AlexRayne||Assigned To||Jonas Maebe|
|Status||closed||Resolution||no change required|
|Summary||0012737: property indirect overloading - goes trough overloading access methods|
i've try to use overloading of array propertyes and got an arror "duplicate identifier ???", as unexpected solve of my problem i found that overloaded
access methods ignores property definition and provide such overloaded property
use in expressions.
here is example:
some = class
function GetX(id : integer) : integer;overload;
function GetX(id : string) : integer;overload;
procedure SetX(id : integer; value : integer);overload;
procedure SetX(id : string; value : integer);overload;
property X[ id : integer] : integer read GetX write SetX;
//property X[ id : string] : integer read GetX write SetX; //this got an error - duplicate identifier X
property XByName[ id : string] : integer read GetX write SetX;
function some.GetX(id : integer) : integer;
function some.GetX(id : string) : integer;
procedure some.SetX(id : integer; value : integer);
procedure some.SetX(id : string; value : integer);
A : some;
A := some.create;
A.X['some'] := 0; //this is bug but useful for property verloading
A.XbyName := 0; // here is same
please, report, how this bug resolved - imho, property overloading should be allowed in at least for objfpc mode.
|Tags||No tags attached.|
|Fixed in Revision|
in delphi mode overloaded propertyes alowed and error - duplicate identifier X is not occured, but bug with indirect overloading is still present.
So, imho, this bug must be splited on 2 different bugs:
1) objfpc mode not allowed overloaded properties
2) indirect overloading of properties
So, please, do it. I would like to hear about the opinion of the fpc team to objfpc and overloaded properties.
It would break RTTI, because there the properties are looked up by name (getpropinfo() and friends). There are ways to filter by type, but these are coarser than the types supported by the compiler (e.g., there are tkInteger, tkInt64 and tkQWord, but no tkByte or so).
Not allowing overloading for published properties, or limiting the overloading possibilities for properties compared to methods/procedures/functions would introduce inconsistencies to the language (and the compiler code).
It could also wreak havoc with streaming (it also uses RTTI to look up properties).
So I don't think it is worth all the possible trouble to add this. I'm pretty sure that's also the reason why Delphi does not support it.
|2008-12-01 12:37||AlexRayne||New Issue|
|2008-12-03 13:27||AlexRayne||Note Added: 0023662|
|2009-02-08 16:34||Jonas Maebe||FPCOldBugId||=> 0|
|2009-02-08 16:34||Jonas Maebe||Severity||minor => feature|
|2009-02-08 16:34||Jonas Maebe||Relationship added||has duplicate 0004907|
|2009-05-30 18:00||Jonas Schäfer||Note Added: 0028153|
|2009-06-06 14:01||Jonas Maebe||Status||new => resolved|
|2009-06-06 14:01||Jonas Maebe||Resolution||open => no change required|
|2009-06-06 14:01||Jonas Maebe||Assigned To||=> Jonas Maebe|
|2009-06-06 14:01||Jonas Maebe||Note Added: 0028326|
|2009-12-15 11:58||Jonas Maebe||Status||resolved => closed|