@property - take it behind the woodshed and shoot it?

Johannes Pfau nospam at example.com
Sat Jan 26 01:30:57 PST 2013


Am Fri, 25 Jan 2013 21:38:44 -0800
schrieb Walter Bright <newshound2 at digitalmars.com>:

> On 1/25/2013 2:14 PM, Jonathan M Davis wrote:
> > A property function is fundamentally different from a
> > normal function by its very nature, not just by its call syntax.
> 
> I would have agreed with you on that for years, simply taking its
> veracity as an axiom, but lately I am not convinced at all of that
> assertion. I suspect the differences between a property, field, and
> method are purely contrivance.
> 
> For example, even accessing a global variable isn't straightforward,
> if you look under the hood. If it's in a DLL or TLS, there may be a
> function call in there that is non-trivial.
> 

Although variable access might be implemented as a non-trivial function
calls everyone tries to make these as fast as possible. Think of
PLT/GOT or the TLS register on ARM processors.

And this is the difference between variable/property and function:
Access to the former has to be 'fast'. There's no real definition of
fast in this case, but I doubt an O(n^2) implementation of TLS or
variable access in general would be acceptable to anyone.


More information about the Digitalmars-d mailing list