Functions over read-only properties: you cannot mark a property as deprecated in delphi – via Stack Overflow
Posted by jpluimers on 2017/06/07
I learned one of the reasons you might want to use functions instead of read-only properties from properties – How can I mark a property as deprecated in delphi? – Stack Overflow [WayBack]:
Delphi hinting directives: deprecated, experimental, library and platform cannot be used on properties but can be on other members (like fields, procedures and functions).
Since a read-only property is very much like a read-only field, but fields cannot be read-only it can make sense to replace the read-only property with a function. Then on the function you can place hint directives.
This can help enormously refactoring large code bases where – because of size – you cannot perform a certain replacement in one step.
–jeroen
Leave a Reply