Handle with-statement to modify records in properties with setters
Original Reporter info from Mantis: hitman
-
Reporter name: Andreas Schneider
Original Reporter info from Mantis: hitman
- Reporter name: Andreas Schneider
Description:
The attached example demonstrates the current behavior:
Using the with-statement on a property that directly reads/writes a record member, it successfully compiles and runs; i.e. at runtime, the values of the record fields are actually set.
When using the with-statement on a property that uses a setter, the compiler doesn't complain, but on runtime, the actual record fields stay unchanged.
At worst, this should throw a compiler error (or warning). At best, this should be handled cleanly, by calling the setter with the modified record. (Although it's probably up for discussion, whether it is clean to implicitly call methods in that case ...)
Additional information:
I don't have Delphi at hand to test how it behaves in this particular case.
Mantis conversion info:
- Mantis ID: 23620
- Monitored by: » Ask (Alexander S. Klenin), » Nitorami (Nitorami)