Wednesday, May 03, 2006

get_ and set_

By default, if you have a property named MyProp, Delphi assumes methods named GetMyProp and SetMyProp. Per a Delphi 2005 book I have read, Delphi.NET actually compiles this code creating new methods get_MyProp and set_MyProp which in turn call the original methods. We could eliminate this extra layer if we just use get_ and set_ for the original names. This would have at least a minor improvement in performance. So, should we set a standard of get_ and set_ for future property specifier names?

PS: if the specifiers simply refer to an element such as FMyProp, Delphi still creates get_ and set_methods that then access FMyProp.

1 comment:

Brad said...

IMO, no.
- The performance difference would be infinitesimal.
- Why make a standard around what amounts to a "black box" detail in the current version of Delphi?