On Tue, May 15, 2012 at 11:09 PM, John Maschmeyer <jmasc...@gmail.com> wrote: > On Tuesday, 15 May 2012 at 17:18:57 UTC, Philippe Sigaud wrote: >> >> Can you give us a simple example of what codeof produces? How does it >> deal with functions overloads?
(examples) > ************* Wonderful. I'm already salivating, er I mean I'm quite eager to get my hands on it. Jeebus, we will be able to do wonderful things with this. Code extraction, parsing, AST modif and then code re-creation and mixin. If you give it a module name (qualified with package name), does it output the entire module code? > I'm not sure how well this works with overloads. If you just use the symbol > name, it works like other traits and returns the source code for the first > match. I tried using the getOverloads trait and some alias magic, but all > I've been able to do so far is get the prototype for overloads. I'm > guessing it has something to do with using an alias instead of the actual > symbol. I think we need a better way to reference an overloaded symbol. Don't sweat it for now. It's a bit more uncommon. what does this output? int foo() { return 0;} int foo(int i) { return i+1; } void foo(double d) { } foreach(i,overload; __traits(getOverloads, "foo")) writeln(overload.codef);