Tuesday, June 08, 2004

Resolver Testing
Today was a combination of reading papers (this one among others) and modifying AN's tests to work on remote resolvers. The original tests are designed to use RDF files as models, while the new ones need to refer to models on a TKS session. This means creating the models, and then loading the files into them, before anything can proceed. It's not as easy as it first seemed, but it's starting to come along.

Had a chat with DM this morning about indexes. His skip lists have been proceeding apace, and I'm impressed with some of the ideas. As we talked about it I started to realise that some of the ideas for the systems that we each want to build are portable. I may end up borrowing from him. I'd suggest that he could borrow from me and put some hashtables back into his design, only the hashtables were his idea in the first place. Very cluey guy.

I started coding the hashtable implementation last night. At this point I just want to get it up and running, so it has a very posix feel to it (mmap, lstat, etc), but I plan on making it portable across to Windows. DM reminded me that he has an old library that implements basic mmap functionality for Windows, and voluntered its use. There's no point in rewriting the wheel, so I'm happy to use it.

In the meantime I was both pleased and frustrated at C. It's been some years now since I've coded in pure C (I've edited code in C, but it's different to writing your own code from scratch). Of late everything has been C++ or Java, and the shift was a bit jarring. No exceptions, no method overloading, and building my own structures to be passed as the first parameter of functions (instead of implicit this parameters). It is easy ebough to code around these things, but it feels like I have to work harder to get the same thing done. Conversely, it was an absolute pleasure to cast a pointer returned from mmap() directly into a stucture, and to modify a file that way. Made it all worthwhile really. :-)

If I steer clear of some of the less efficient features (like vtables) then C++ would give me the best of both worlds, but I'm trying to write simple portable code, and I keep coming back to the OMS project back in 1999. OMS was written entirely in C++, which most people just accepted. Then Allan Cox came onto the list and volunteered to help, only he asked if it might be possible to port the code to C because he didn't know C++. This brought forth a number of people who had the same problem. It was not changed (except perhaps in some lower level modules), but ever since then I've been more inclined to do open sourced code in C rather than C++.

The world has moved on since K&R, so I should check out C99 so I will not be restricting myself from using all of the latest and greatest features (eg. I like single line comments). I'll Google for it tomorrow. Hopefully I'll find a free copy. In the meantime both AM and DM have suggested gcc. If it were just Linux and OSX then I would, but I feel weird about using it for Windows. Maybe I shouldn't be so biased. I'll have to set aside some time to reboot to Windows and test it out.

No comments: