Monkey Patching in D
Peter Lundgren
peter at peterlundgren.com
Tue Jun 4 19:18:34 PDT 2013
I'm interested in trying to write a monkey patching* library in
D. Specifically, aiming to support mocks and stubs for unit
testing.
I have a couple of questions:
1) What prior art is there here? I am aware of DMocks (does this
project still need a maintainer?).
2) How crazy am I for even thinking this is a good idea? Are
there any obviously better alternatives.
* I'm not sure if there is well defined terminology here
(especially applying these ideas to compiled languages). To
clarify, when I say monkey patch, I mean to intercept a function
or method call at run-time. I believe, in the case of D, this
would require self modifying code using techniques like those
used here:
http://www.yosefk.com/blog/machine-code-monkey-patching.html
More information about the Digitalmars-d
mailing list