Dealing with property function and operator overloads

Andrej Mitrovic andrej.mitrovich at gmail.com
Tue Oct 4 16:49:27 PDT 2011


On 10/4/11, Jacob Carlborg <doob at me.com> wrote:
> No "alias this" in the wrapper?

I shouldn't have named it Wrapper, you could better think of it as a
Widget with a position field, if that position is changed (and not
just read from) then some kind of repaint mechanism would be invoked.

However I shouldn't invoke such a mechanism if the value of the
payload hasn't actually changed, so I should have a check inside of
opAssign/opOpAssign. Additionally, "payload" might have its own
functions which change its internal state. So to work around this, I
would have to introduce opDispatch as well. Here's what I have so far:

http://codepad.org/uSEMcD0g

In the sample the Point structure is missing operator overloads, but
if it had them they would be trapped by TrackChanges.


More information about the Digitalmars-d-learn mailing list