On Monday, 14 May 2012 at 20:27:37 UTC, Ali Çehreli wrote:
On 05/14/2012 11:49 AM, Stephen Jones wrote:
> My
> understanding is that c# getter setters were simply syntactic
sugar
> which under the hood called standard functions incurring the
standard
> function overhead. Is this the same with D, or does D
implement
> properties using pointers to the required data fields?
It is the same with D but the compiler can optimize out the
function call in cases where that is possible.
Ali
Thanks Ali for the syntax, some very useful bits and pieces I did
not know. I do not want to use property syntax. Form a
performance perspective I cannot see any good reason not to
simply use an array of pointers to the different objects
(buttons, cursor, etc) rather than incurring function overheads.
Except for the good reason that I do not know the syntax.
Ary: I seem to remember playing around with a Simpsons extending
program in Java that did this; you could throw all the different
Simpsons into a single Array because they extended "Simpson", and
you could walk through the array and each would call their own
name. I kind of purposely left the language vague in case I was
mistaken.