I ended up writing a half-baked hacky implementation of something like this recently. Thanks to Mark for writing something which (presumably) works properly :)