digitalmars.D - Recording object states
- Andrej Mitrovic (11/11) Oct 01 2011 I just thought it's really cool how D makes this possible and very
- Simen Kjaeraas (7/18) Oct 03 2011 You might want to consider a template constraint on opDispatch:
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.
Oct 01 2011
On Sat, 01 Oct 2011 17:47:10 +0200, Andrej Mitrovic <andrej.mitrovich gmail.com> 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
Oct 03 2011