You know, I just had an idea. It would be really cool to have some sort of generalized template function which can test other functions in various ways. You could pass strings as options, where you might choose the type of testing being done, such as verification tests or performance tests.. Or if a function is designed to write a file on disk, maybe you&#39;d want to have an option for the maximum number of tests to run on that function (you don&#39;t want to be left with 10000 files written in some temp directory somewhere..), or a test to see if a function will fail with invalid input, etc. <br>
<br>Well it&#39;s just an idea, I better take a look at the existing test frameworks and see how it&#39;s done there.<br><br><div class="gmail_quote">On Sat, Aug 7, 2010 at 4:04 AM, Andrej Mitrovic <span dir="ltr">&lt;<a href="mailto:andrej.mitrovich@gmail.com">andrej.mitrovich@gmail.com</a>&gt;</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;">Damn regexe(s|n).<br><br>I almost never need them, but when I do, I have to spend an hour trying to remember the syntax (+ I&#39;m really used to doing regexes in Python and then there&#39;s the whole &quot;regex objects in lang x work different than in lang y&quot; thing). But I digress..<br>

<br>I think a better way is to pass strings which will be used to name the variables to be constructed and initialized (+ return an error when there&#39;s too few). And then at least you&#39;ll know there are some new local variables at your disposal by looking at the call. That way we solve both problems.<div>
<div></div><div class="h5"><br>
<br><div class="gmail_quote">On Sat, Aug 7, 2010 at 12:12 AM, Andrej Mitrovic <span dir="ltr">&lt;<a href="mailto:andrej.mitrovich@gmail.com" target="_blank">andrej.mitrovich@gmail.com</a>&gt;</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;">

Slightly OT: I&#39;ve noticed you&#39;re often missing the word &quot;know&quot; in your posts (e.g. &quot;I don&#39;t what&quot;, that should be &quot;I don&#39;t know what&quot;). Is something filtering your posts? :)<br>


<br>And yeah, I&#39;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&#39;s no way to pass auto variables as parameters, but that&#39;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&#39;t see it in the code), so it&#39;s not all that practical I guess, not to mention a little dangerous. :p<div><div>

</div><div><br><br><div class="gmail_quote">
On Fri, Aug 6, 2010 at 10:22 PM, Philippe Sigaud <span dir="ltr">&lt;<a href="mailto:philippe.sigaud@gmail.com" target="_blank">philippe.sigaud@gmail.com</a>&gt;</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><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&#39;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&#39;d actually get back variables &quot;ftc, fta, ftm&quot; 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(&amp;foo).stringof); // &quot;int function(int i, double d)&quot; &lt;-- Look Ma, arguments names!<br>



<br>But it&#39;s a quirk of .stringof, I&#39;m not sure it&#39;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>-&gt; &quot;int i, double d&quot;<br>



and from there, extracting i and d.<br><br>I don&#39;t what will happen for overloaded functions, methods names, constructors, ...<br><font color="#888888"><br><br>Philippe<br><br>
</font></blockquote></div><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>