Archive for the ‘Development’ Category
In Praise of s-Expressions
OCaml is a wonderful language. But as with any language, there are certain features you would like to see.
The obvious one in OCaml is the lack of type-classes, specifically the lack of Haskell’s Show. There is no more useful debugging tool than printf, and it is a pain trying to debug complex types when you can’t see them.
This is where s-expressions come in. Specifically, Jane Street’s s-expression library.
Strict Beyond Reproach
Pascal Cuoq made an interesting comment on my last post about C developers accidentally writing “==” in OCaml when they meant to use “=”. It reminds me of a similar issue I run into, when I am writing in OCaml but thinking in Haskell, and I am confronted with a value of type:
'a option list
Glossing over Bugs
We have a set of end-to-end tests that run on Goanna every night. This ensures that our commits during the day don’t break our development tree too badly.
Here is one of those tests. It was producing a strange result.
void example(void) {
int *x;
x = malloc(sizeof(int));
free(x);
if (rand()) {
x = malloc(sizeof(int));
}
*x++;
}
Adding Checks for pure, const Attributes
The gcc compiler supports several “attributes” that you can tag a function with. The semantics of those attributes is described informally and, indeed, gcc doesn’t check that they attributes are observed. In other words, the attributes are just decorative, and really have no semantics at all.
You are currently browsing the archives for the Development category.

