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
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel