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

Michael Van Canneyt michael at freepascal.org
Thu Jun 11 16:48:56 CEST 2009



On Thu, 11 Jun 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.

Stop:

It's only for indexed properties, not for normal properties. The index type
uniquely determines which one you want. Just as in a procedure, the argument
type determines which one you want.

Michael.


More information about the fpc-devel mailing list