[fpc-devel] indexed property with default value for param?
Martin Friebe
fpc at mfriebe.de
Thu Jun 11 21:10:22 CEST 2009
Daniƫl Mantione wrote:
> Op Thu, 11 Jun 2009, schreef Michael Van Canneyt:
>> On Thu, 11 Jun 2009, Jonas Maebe wrote:
>> I would think it is a natural extension of procedural overloading ?
>
> It's not that simple. Properties can be both hidden variable access as
> well as procedure access. Variable overloading is not allowed, because
> it causes a lot of issues, i.e.:
>
> var a:word;
> a:char;
>
> begin
> a:=1;
> a:='!';
> writeln(a); {what does this mean??}
> end;
>
>
> Property overloading gets you the same issues, i.e. in the example
> above you could replace both variables with properties and answer the
> same question.
>
> Considering this, I do not think it can considered a logical extension
> of procedure overloading.
Good point.
However the example above (even so you use the setter [assign to the
property] instead of reading), is the same as overloading *functions* by
result.
You can not overload functions by result; still you can overload them by
arguments.
So consistency of overloading functions is *not* defined by being able
to use every bit of information on the function for the overloading; but
only selected (the parameters passed to the function).
On properties this question was about the index given to a property
(number and type of indexes). I do agree, it can not be about the type
of the property itself.
Martin
More information about the fpc-devel
mailing list