Mar 16, 2007 18:51
Sorry for the dearth of code, recently. I was trying to make this a developer's blog unlike a great many other developer's blogs, wherein I showcase actual code I've written instead of simply musing about whether or not FizzBuzz is a legitimate interview problem.
It's just that I've been working on Gamsock lately, and I don't want to show anything really until I know it's right. Gamsock is my attempt at writing an improved socket layer for Gambit, with an API similar to the Scsh socket API, which Olin Shivers put forth years ago as an example of a socket API done right. The problem these days is that while the API structure is itself impeccable, it's somewhat fallen behind the times in terms of what it supports, as there is for example not even IPv6 support. And this is -- arguably -- the best, most complete API for Scheme out there. Gambit's socket API wins points for cool tricks (like listening and accepting connections on a server socket by doing (read s); each object read from the socket is itself a new socket), but loses for relative incompleteness.
I think I've articulated a relatively clear vision for the direction Gamsock should go: If it's supported by your OS, it should be supported by Gamsock.
Note that this mission statement assumes a suitably commonplace and Unixoid value of "your OS". At this point I have no real interest in making Gamsock work on Win32.
The problem, such as it is, is that for example Linux and OpenBSD have various socket types, protocols they support, socket options, and even errnos. I want programming against these APIs in Gamsock to be just as straightforward as if you were using C. My current approach -- using OS-specific files which define all sorts of constants brought in from C -- is bogus. (The approach I took in the previous Gamsock release doubly so, as all the constants were hard-coded.) It is like the old lazy webdesigner's trick of writing an Internet Explorer page and a Netscape page. Such pages should query based on available features, not browser versions; and it is the same with Gamsock. Somehow I need to take the union of all possible socket options, errnos, and so forth, and determine which ones are apropos to the current environment, and then write them out to a Scheme file to be included in the compiled library. I have an approach in mind, but it is hacky.
I will let you know how it turns out; if successful, I will incorporate it as code.
sockets,
scheme,
gambit,
network,
gamsock