The <a href="http://www.freepascal.org/docs-html/ref/refse17.html#x45-520003.6">procedural types</a> doc is informative, thanks for the suggestion.<div><br></div><div>Eh, much humor will be lost on me. I'm a Pascal newbie, so if you suggest function pointers, even with (satire!) comments, that's what I'll use. Pointers do the job in C, why shouldn't they in Pascal?</div>
<div><br></div><div>There are CodeSOD hacks, and there are necessary hacks. If you don't like the void* trickery in <a href="https://github.com/mcandre/qc">qc</a>, issue a pull request.</div><div><div><br></div>Cheers,<div>
<br></div><div>Andrew Pennebaker</div><div><a href="http://www.yellosoft.us" target="_blank">www.yellosoft.us</a></div>
<br><div class="gmail_quote">2011/10/18 Roland Schäfer <span dir="ltr"><<a href="mailto:roland.schaefer@fu-berlin.de">roland.schaefer@fu-berlin.de</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 10/18/2011 10:23 PM, Andrew Pennebaker wrote:<br>
> Schäfer, thanks, that's a lot of practical information. Have you used<br>
> Haskell QuickCheck<br>
<br>
</div>In fact, I have, but I don't see the connection.<br>
<div class="im"><br>
> Yes, pointers are probably the only way I can implement this, for now. If at<br>
> all possible, I'd like to use more idiomatic Pascal code.<br>
<br>
</div>Those sentences form a contradiction.<br>
<div class="im"><br>
> but there's only so much you can do without lambdas.<br>
<br>
</div>I saw the l-word coming.<br>
<div class="im"><br>
> If I decide to use pointers,<br>
<br>
</div>... you'll end up on CodeSOD.<br>
<div class="im"><br>
> what's the syntax for accepting a function<br>
> pointer (unknown type, unknown arity) and calling the function? In C, you<br>
<br>
</div>In Pascal, you use procedural type variables, not function pointers; it<br>
makes a conceptual and a practical difference. Procedural type variables<br>
have a type (hence the name). You can push them around as untyped<br>
Pointers, but you shouldn't. My *joke* was about turning the result type<br>
of your functions into Pointer, so all your GenSomething functions are<br>
of the same procedural type and can thus be accepted as an argument by<br>
your generator... with virtually unusable results. Please, RTM.<br>
<br>
> In C you have to know the entire function signature and explicitly cast the pointer<br>
<div class="im">> to that before you can call it. Does Pascal also require this, or can I just<br>
> accept a pointer and call it as if it were a normal function call?<br>
<br>
</div>If you read the aforementioned reference and meditate about it, you<br>
might notice why you don't have to cast procedural type variables in Pascal.<br>
<br>
Regards,<br>
<font color="#888888">Roland<br>
</font></blockquote></div><br></div>