Disk Clock latest 1.4. Jumped back to the last branch before I got off on the parsing tangent. Fixed the Chrome problem in DC-latest, implemented the time-unit dsl, and cherry-picked a few bug fixes to the debug logging system made on the parsing branch.
A Fork in the Road
So far Mercurial has risen to every task I’ve put before it. I exported the DC history, removed and edited the ones with the big fancy parser, and imported them into a new repository set up for that purpose.
Meanwhile, I jumped back to the last version of Disk Clock before those changes, and cherry-picked some small bug fixes to the debug module I had made in the previous branch. Mercurial calls the operation transplant, which is mildly alarming because it does an immediate commit. You can rollback a single commit, and I suppose just jump back down an earlier revision if something goes really wrong.
Don’t get idea that I spent all weekend on this – Saturday was a martial arts seminar. The functional changes were implemented two weeks ago; the repository reorg, with learning curve, took an hour or two Sunday morning.
Time Unit DSL
Now that there is actually an implementation that an enterprising hacker could play with, I ought to describe what the time unit domain specific language actually does. It lets me say things like ‘ms/day’, ‘seconds/year’, or ‘-70 days/years’.
It’s worked out fairly well. A couple of case made me have to think about it a bit, and the really wonderful thing is that finding a legal expression that made sense clarifies the understanding of the concept. For instance, the UNIX doomsday disk counts the number of seconds that fit in a 32-bit signed value. Before the DSL, I used “Math.pow(2,31) / (S_M * M_H * H_D * D_SY)” The literal translation of this to the dsl is something like ‘(seconds/year)/2^31′ (I implemented exponents just for this) which isn’t very enlightening. After thinking about it for a while and shuffling things around, I arrived at ‘years/(2^31 seconds)’ which is actually an accurate description of what the disk is showing.