Slightly OT: I've noticed you're often missing the word "know" in your posts (e.g. "I don't what", that should be "I don't know what"). Is something filtering your posts? :)<br>
<br>And yeah, I've noticed your other thread with the argument names. With a little bit of regex I could easily extract the variable names. I think this template could be useful in cases when you just want to try out a function which happens to writes some state in the parameters that are passed to it (out/ref params), without having to inspect the function signature and declare the proper variable types. Unfortunately there's no way to pass auto variables as parameters, but that's more of a Python territory, I guess.<br>
<br>On the other hand, the template introduces new identifiers silently into the calling site (you can't see it in the code), so it's not all that practical I guess, not to mention a little dangerous. :p<br><br><div class="gmail_quote">
On Fri, Aug 6, 2010 at 10:22 PM, Philippe Sigaud <span dir="ltr"><<a href="mailto:philippe.sigaud@gmail.com">philippe.sigaud@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Andrej:<div class="im"><br><div><div> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>It was just an exercise for fun but it's cool that things like this
are possible in D. It would be nice if I could get the actual names of
the parameters the function takes + the clear name of the function
itself, that way I'd actually get back variables "ftc, fta, ftm" back)</blockquote>
<div><br></div></div></div>There, found it again, while answering another thread:<br><br>int foo(int i, double d) { return 0;}<br><br>writeln(typeof(&foo).stringof); // "int function(int i, double d)" <-- Look Ma, arguments names!<br>
<br>But it's a quirk of .stringof, I'm not sure it's a good idea to rely on it too much.<br>from there, using compile-time search in a string, you can extract the arguments (those are between ( and ) )<br>-> "int i, double d"<br>
and from there, extracting i and d.<br><br>I don't what will happen for overloaded functions, methods names, constructors, ...<br><font color="#888888"><br><br>Philippe<br><br>
</font></blockquote></div><br>