"hijackable"/"customizable" keyword for solving the "customized algorithm" issue?
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Thu May 15 05:16:52 PDT 2014
On Thu, 15 May 2014 02:05:08 -0400, monarch_dodra <monarchdodra at gmail.com>
wrote:
> "move" will also delegate to "proxyMove".
This is the correct solution IMO. The principle of least surprise should
dictate that a.foo should always mean the same thing. All that is required
to enforce this is to make the "hook" function have a different name.
I think the two mechanisms of overriding default behavior:
1. Use a hook, to define the basic minimum functionality.
2. Implement the same-named method, but you must implement ALL
functionality (possibly deferring to the global function if necessary).
-Steve
More information about the Digitalmars-d
mailing list