Long time no diary. Partly this was server troubles at advogato, and partly natural laziness and indolence. Does this augur good or ill for a forthcoming academic research career? We shall see.
What have we learnt in the meantime, anyway? Well, those who follow this diary may have observed a certain bias towards technical minutiae of Common Lisp and its ANSI specification. We have an amusing unintended consequence for your delectation this month: on a strict reading of the specification, it is not possible to portably define a constant equal to a floating point zero.
How did they manage that? Well, the ANSI committee might have sometimes overlooked things, but they weren't completely nuts. So it's a combination of a series of things, all but one reasonable.
- an implementation is free to evaluate DEFCONSTANT's value form at compile-time, run-time or both. This is reasonable, so that the compiler can do constant-folding.
- the consequences are undefined if DEFCONSTANT attempts to set an already-bound constant to a value that is not EQL to itself. In the vernacular, this means that it's OK to set a constant to a value that's the same as the one it's already got.
- the file compiler dumps objects according to an abstract similarity relationship, such that when the loader (linker, to you static language unwashed masses) gets involved the resulting object is similar to the one that was dumped. A reasonable specification, given that the loader can theoretically be from a different lisp session altogether.
- the TYPE-OF an object cannot involve the MEMBER type specifier. Reasonable, because otherwise (type-of <x>) is trivially `(member ,<x>), which doesn't tell anyone anything.
- similarity on numbers is defined as being of the same type and with the same mathematical value (under =).
Superficially, this last requirement looks reasonable, but there's a catch! 0.0 and -0.0 are necessarily of the same type, since the only type that can distinguish between them is a MEMBER type (or equivalently the EQL type); they are, in IEEE parlance, also representations of the same mathematical value; (= 0.0 -0.0) is true. Thus, technically, an implementation is free, on compiling and loading
(defconstant +foo+ -0.0)to go as follows: firstly, evaluate the value form at compile-time, getting -0.0, and do the defconstant. +FOO+ now has the value -0.0. Then dump this code, and obeying the similarity rules, dump it such that the -0.0 is now 0.0. Now on loading, we attempt to set +FOO+, currently with value -0.0, to the value 0.0, which is not EQL to -0.0; hence we get undefined consequences. No, I don't plan to exploit this loophole in SBCL; we get enough complaints about defconstant as it is.
The moral of this tale? Maybe this.
In other news: no noticeable progress on the pi calculus, no.