Working on it!

No posts lately, as I have been working on a lot of stuff, but it just doesn’t seem to finish all that quickly. For example, I have been trying to get the client working on my laptop for my company’s VPN. It’s almost there. It’s stopped throwing errors about MPPE (it wanted to load a kernel, but I built it into the kernel), but still no dice. As a nice side benefit, I upgraded my kernel and deleted a lot of the spare code I had laying in my /usr/src directory.

Ocean’s macros have made some progress. The past couple of days they were completely broken. Then, today, a breakthrough. Now they are only half-baked, needing the following problems fixed/tested: templates are assumed to be lists (this need not be the case; they could be a symbol, list, or template), the handling of literal identifiers, not allowing improper lists to match against proper lists, and hygiene (not tested).

Finally, I have been working on a Haskell tutorial. It is coming along nicely on the whole, with one stumbling block: the pragmatic use of Monads to handle state and imperative-style components. I understand it for the second half. In fact, that part is pretty easy to grasp, but the use of monads and monad transformers is trickier. I understand the concept of layering them. I just don’t understand what they are. It’s one of those I 75% understand situations. I just need to fill in that last 25%.

In some ways, Haskell is closer to being a functional language that is ready for steady applications programming than is Scheme. GHC’s performance is pretty darn good at this point, so that whole can of worms is pretty much under control. Moreover, it has better library support at this point with work being done on several widget sets (gtk2hs looks pretty good, but I haven’t taken it for a spin yet), SDL, and OpenGL. Many Scheme implementations have bindings to OpenGL, but few have SDL or GTK support that is anything better than alpha (including my favorite, Chicken). The biggest obstacle is that, despite many tutorials on the web, monads and monadic effects are a little tough to find good, low-level material on. I am close to becoming a Haskell convert. I just need to figure those monads out.

Services vs. Products

Microsoft, IT’s biggest player, makes its money by selling stuff and it dabbles in services. They want you to buy Vista, Office 2007, CRM, the XBox, etc. On the side, they offer crummy overpriced support. The interesting thing about this is that the industry is moving more and more towards services. Red Hat, IBM, and Novell have pretty much bet their futures on OSS software in which they sell relatively little, but provide many services. Even Oracle, who have been selling Oracle for a long time, are getting into the services business with their recent “Unbreakable Linux” offering. Microsoft has resisted this, but even they have been forced to acknowledge the value of giving some software away (hence the “Express” editions of Visual Studio and SQL Server). This raises in an interesting question: what would happen if Microsoft moved towards a services oriented business model without moving towards open source? If any schnook could, legally, get on the internet and download Windows XP Home and Office 2007? Under this hypothetical model, Microsoft would sell business-oriented extensions to Windows and Office, but give fully featured versions away for any use, then charged for the support and custom editions/additions. What would happen? Would this be a good idea for them? It would partially diffuse a lot of the advantage behind switching to Linux.

Honestly, I think it would be hard but it may become fact some day. Even smaller software houses often make more money off of software maintenance than the software itself. As a plus, it is a lot less menacing then “leasing” software.

Today I more or less got stuck writing, or rather updating, documentation. It is a slow, grinding, maddening, thankless task, more concerned with the details of page layout (to bold or not to bold; that is the question. Whether ’tis nobler to suffer the look of undecorated text upon mine eyes, or…) than with any genuine content. So, the Mad Computer Scientist, in an effort to remain sane or, perhaps more accurately, to remain insane in the same way and at the same level as before (i.e. no Uzi mania today), has taken to the safe haven of compiler R&D in between bouts of homicidal fantasies about users (as it requires no level of intelligence to work on documentation; indeed, the ability to shut the brain down would make the task easier). I have been reading Guy Steele’s paper on RABBIT, a Scheme compiler written in MacLISP.

There is a gap between functional and semi-functional languages (ala Scheme, ML, Haskell, and LISP) and procedural ones (like C, C++, C#, Java, VB, etc.). While most people who used procedural languages first have a difficult time wrapping their brains around functional programming (hereafter to be often abbreviated to FP) the first time around, it actually offers a great deal more flexibility than procedural languages. The world, however, is fraught with procedural languages and, at their core, the computers we use every day are procedural. Ultimately, in sheer pragmatic terms, whether directly or through an intermediary, FP must be translated into the more rigid procedural model.

As I get closer to having a design worth implementing (which I should get to soon; macros are almost ready), I’ll post the implementation plan here.

Macros

I was examining my TODO list for Ocean (which is of decent length and, my being all for technology and all, is kept entirely on paper) and decided I had to pick the next task to really go at. Numeric tower support is almost done and is largely a matter of detail which, while important, needs to be broken up for the sake of keeping me awake and sane (so help me if I have to write another override operator function…). In the end, I selected to start work implementing macros. It was an arbitrary choice, but one that makes sense in light of the research I’d been doing on Scheme compilation.

As I read and reread the pages from the current (R5.92RS) draft, a few thoughts occurred to me. The most obvious was that I was here preparing to implement a feature in Scheme that I had not used to date. I have used macros sparingly in C/C++, but never in Scheme. I just never really saw a reason in the things I was doing with it. The second thought was that Scheme’s macros seem to hold almost as much worth, if not more, for the language implementor. It seems like an interesting thought, doesn’t it? Macros are expanded prior to interpretation/compilation (as the case may be), so they can be used in the process of interpretation/compilation–and that is what many systems (including Ocean, when it gets that far) do: define a core set of forms and everything else as default macros based on those forms. It’s an interesting exercise to try and think of ways to rewrite common Scheme constructs as macros. A simple macro for the let form could be:

(let ((x 1) (y 2)) ) -> ((lambda (x y) ) 1 2)

Interesting, huh?

(display “Hello, world!”)

To use the Scheme code for a cliched intro to programming. If you are bored enough to want to know who I am, go to the “about” page (which should be up shortly if it isn’t now). As this is the inaugural post to an inauspicious blog by an inauspicious person, this first post will be about this blog’s manifesto.

1. Computer science and techniques are interesting in and of themselves. You can find pragmatic snippets of VB code all over the internet, but that is not really the point here. Here, I intend to post questions and thoughts regarding the more theoretical aspects of compsci as well as thoughts and results from various experiments. I am an experimenter by nature, and I will try things for no better reason than to try them. In short, I believe firmly in learning through discovery (another name I thought of for this blog was “For the Heck of It”). In addition, my various coding projects also act as laboratories for ideas and curios. I will post with regard to them. Code snippets are far more likely to be in bash, Scheme or Haskell, then anything else.

2. Theory is good, but in order for it to be truly useful it must be applied. Virtualization theories are little good if they cannot be realized in superior virtualization software. Programming languages are useless unless they can be useful. A toy language is either a hobby or the spawn of a grant/academic paper. Toys may grow, but if they stay toys they will be forgotten.

3. Zealotry is a negative for the advancement of technology. There are Linux fanatics, Mac fanatics, Windows fanatics, Haskell fanatics, Scheme fanatics, functional programming fanatics, ad infinitum. There will always be different ways of getting tasks done, but rather than getting overly-hung up in one camp, it is far more useful to experiment and then draw conclusions from those experiments.

As said in point 1, I will post with regard to my various pet projects from time to time (in fact, it will probably be pretty regular). My main projects at the moment are the following:

1. Ocean – Scheme for .NET (http://oceanscm.sourceforge.net/) I have not yet put up a SourceForge web site for this yet, but the essential idea is this: I like Scheme. I like it a lot. It’s neat (as long as you don’t start using those stupid []’s) and very elegant. Then I tried to create Latrunculi (see item 2) and I hit on a snag: as nice as Scheme is, the libraries are bare to the extreme.
If Python is the “batteries included” language, then Scheme is the “make-your-own-batteries” language. About this time the first draft for the R6RS came out. It standardized a lot of the idiosyncrasies between Scheme implementations and one of my favorite features to be added was standardized byte vectors. So, I decided to write myself a Scheme — and do it natively on the .NET framework. This would kill two birds with one stone: I would get a jump on the latest Scheme and would give me instantaneous access to a wealth of libraries which is still growing (and probably will be for the forseeable future).

2. Latrunculi (http://latrunculi.sourceforge.net/) – a nice, OpenGL version of an ancient Roman board came, something like Chess or Checkers, but more similar to the game of Henafatafl. Started one boring day at work to get a chance to implement the MiniMax (though I later switched to the more elegant NegaMax) algorithm and grew from there.