The procedural 
types<http://www.freepascal.org/docs-html/ref/refse17.html#x45-520003.6>doc
is informative, thanks for the suggestion.

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?

There are CodeSOD hacks, and there are necessary hacks. If you don't like
the void* trickery in qc <https://github.com/mcandre/qc>, issue a pull
request.

Cheers,

Andrew Pennebaker
www.yellosoft.us

2011/10/18 Roland Schäfer <roland.schae...@fu-berlin.de>

> On 10/18/2011 10:23 PM, Andrew Pennebaker wrote:
> > Schäfer, thanks, that's a lot of practical information. Have you used
> > Haskell QuickCheck
>
> In fact, I have, but I don't see the connection.
>
> > Yes, pointers are probably the only way I can implement this, for now. If
> at
> > all possible, I'd like to use more idiomatic Pascal code.
>
> Those sentences form a contradiction.
>
> > but there's only so much you can do without lambdas.
>
> I saw the l-word coming.
>
> > If I decide to use pointers,
>
> ... you'll end up on CodeSOD.
>
> > what's the syntax for accepting a function
> > pointer (unknown type, unknown arity) and calling the function? In C, you
>
> In Pascal, you use procedural type variables, not function pointers; it
> makes a conceptual and a practical difference. Procedural type variables
> have a type (hence the name). You can push them around as untyped
> Pointers, but you shouldn't. My *joke* was about turning the result type
> of your functions into Pointer, so all your GenSomething functions are
> of the same procedural type and can thus be accepted as an argument by
> your generator... with virtually unusable results. Please, RTM.
>
> > In C you have to know the entire function signature and explicitly cast
> the pointer
> > to that before you can call it. Does Pascal also require this, or can I
> just
> > accept a pointer and call it as if it were a normal function call?
>
> If you read the aforementioned reference and meditate about it, you
> might notice why you don't have to cast procedural type variables in
> Pascal.
>
> Regards,
> Roland
>
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to