Disk Clock 1.0.3: Chromed

Disk Clock weathered the introduction of Google Chrome fairly well, although the outer rings were not getting drawn. I’ve issued a patch release 1.0.3 for use on the web site and sites using the widget in a web page. Further development on the latest branch got caught in a semi-major project.

No updates the week before: I’ve been working a game design domain specific language embedded in ruby, and it will be a while until I get something presentable.

1 % 1 = 0

I’ve been using Javascript’s floating point modulus to bound revolutions – taking 3.2 % 1 gives you 0.2 turns. It also turns out that 1 % 1 = 0; most of the drawing engines were taking this (converted to radians) (possibly plus a fudge factor) and drawing a complete arc. Chrome’s engine, however, saw 0-0 and drew nothing. I’ve made a couple adjustments to the handling of revolutions, and specified rings as 0-0.9999.

A Plan For Modularization

I made a few small changes to the latest branch, and then set out to to solve one of my modularization problems – the TIME.UNIT collection. This is where I ran into trouble with the new version of WebKit; withing the TIME.UNIT object as a namespace didn’t work for function statements. I now know that function expressions would have worked, but this experience combined with the the standard cry against the with statement has turned me off a bit. I’m not complete at ease with the namespace-explosion operation.

The Time Unit DSL

I had the idea to solve the time unit problem with time unit Domain Specific Language. It lets you write things like “5 seconds/day”. I’ll have more to say about it when the code is posted. I got a working implementation, at least for every case used in in DC, by regex-hacking through it.

A Code Too Far

This is probably all DC needs, but as the weekend was only half over, I’m currently reading Compilers (aka the dragon book) and I’ve got some other language projects brewing, I figured I’d see about re-implementing it with some more maintainable methods. Unfortunately, they are also very complicated methods. The lexer went fairly quick, as I cheated and used Javscripts regular expressions rather than building an automaton. The parser is quite an unwieldy beast, and I’ll need at least another day to get something running.

Posted Tuesday, September 16th, 2008 under Devlog.

Comments are closed.