Sunday, October 19, 2008

I knew this was going to happen

Really, I did. I've been waiting on it since February, when I started work on the Handlers. At that point it had been about 2 years since the design of the DOM was laid down, though I had only just completed a code-wise and testing overhaul of it.

Long story short, the DOM was built at a time when I had no idea if my ideas for Carrot would ever work out, much less exactly how they would work out, and the Handlers were created with a far better understanding of how things should hook together. As a result, the DOM wants to have things added to it like this:

$dom->add( type    => $node_type,
           finfo   => \@fileinfo,
           element => $element_name,
           id      => $user_identifier,
           parent  => $pid,
           attrs   => \@attributes,
           content => $content );
while the Grammarian (being fed by the Handlers) wants to add things to the DOM like this:

$dom->add($node);

I'm not entirely braindead; '$node' contains everything that '$dom->add' wants, but it's packaged as a single hashref instead of a unravelled hash. This is far from calamitous, but it is irritating because simply passing '$node' is the right thing to do. This means that the DOM's test suite needs some rewriting.

And I'm still thinking of splitting the DOM in two.

And the DOM's POD needs a lot of rewriting.

And I should probably produce a dedicated POD which describes all the datastructures in the system.