On Sat, 01 Oct 2011 17:47:10 +0200, Andrej Mitrovic
<[email protected]> wrote:
I just thought it's really cool how D makes this possible and very
easy to do. Check it out:
http://codepad.org/yA8ju9u0
I was thinking of using something like this in code samples for a
library (e.g. CairoD), where a Recorder object like this would capture
the states of some shape and then generate a series of images on how
that shape changes over several function calls. And this could easily
be injected into HTML documentation.
Thanks to opDispatch I would only have to rewrite a small portion of
my sample code, replacing "Shape" ctor calls with Recorder(Shape())
calls.
You might want to consider a template constraint on opDispatch:
auto opDispatch(string method, Args...)(Args args) if
(is(typeof(mixin("t."~method))))
--
Simen