[fpc-pascal] Property write access on records

Ryan Joseph genericptr at gmail.com
Thu Mar 5 08:24:19 CET 2020


I didn't get this reply on the mail list and just looked on the mail list archive and found it! Not sure what happened or if it's going to happen again.


Sven's reply:
===============


I assume you mean "sheet.TableSize.x"? Otherwise your example makes no
sense...

In that case: you are working on a temporary copy of the record. It does
not affect the TSheet instance anymore (that's essentially the same reason
why C operators or var parameters are not allowed for properties).

===============

Yes, it's a temporary variable but doesn't it make sense to give an error because the property is read only? It's basically a no-op like it is now and defeats the purpose of read-only properties. It also creates a nasty bug because the programmer thinks they've written to something but they actually didn't.

Can we consider changing this behavior?


Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list