[fpc-devel] FPC 2.3.1 SVN 8427: new compilation error.

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Sep 12 10:44:50 CEST 2007


On 12 Sep 2007, at 09:47, Micha Nelissen wrote:

> Michael Schnell wrote:
>> Theoretically a write to the property _could_ be compiled into a  
>> call to the set method. But with that the called function would  
>> need code to detect if the var parameter is a property and act  
>> accordingly. Though a nice feature, IMHO it would make things so  
>> complicated that it does not make much sense.
>
> It doesn't have to detect, the compiler would generate a temp like:
>
> init(temp);
> get(temp);
> func(temp);
> set(temp);
> destroy(temp);

Apart from being pretty slow, this also has different semantics than  
a var parameter. Suppose you modify the var parameter in the callee,  
and then call another method of the original class instance from the  
callee -> this method will see the original value of the field/ 
property rather than the modified "var" parameter.


Jonas



More information about the fpc-devel mailing list