This page will contain any tips that I have found useful while learning
Pliant. Not much here yet, but I'm sure it will grow. I may even make up a
little form to let people add their own tips...
At this point this is mainly here for my own use, so I don't have to keep looking through back mail or the forum for certain things.
Hubert's reply to my request for a better documented meta programming example (he provides a better documented shunt.pli). Plus a little elaboration.
Tail Recursion & Global External Variables
Another mirror of a forum discussion on how to (memory) optimize tail recursions and how to handle global variables in an external C library.
Here is a local copy of my discussion with Hubert about signal handling. The most useful information is near the bottom.
Prolog Style Clauses
Hubert's overview of different ways to get pliant to handle prolog style clauses. This is another local mirror of a forum discussion.
Hubert expounds on the various forms of the arg syntax.
Critique of my first meta program
I posted my first attempt at writing a FFI wrapper around a C library. I asked for comments/critiques.
Simple question I had about C char data type marshalling.
This is Hubert's description of what 'the_function' does in relation to the CStr type. Specifically, about this line:
((the_function 'cast CStr' AllocatedCStr -> CStr) arg 1) maps := 1
'the_function' means that you want a pointer to the function internals, so you want to do things that have to do with compiling, not just a simple program. Here we want to specify more complex relations with arguments, because the result is mapping the first argument, but the compiler cannot deduce it by itself: if the result had been an obvious mapper (an 'Address' data), then the compiler would have asserted properly by itself, but 'Strz' is not declared so. So, you get to another point: rather than forcing the prototype of the function we could have specifyed that the new 'Strz' data type is an object mapper.