Monday, October 29, 2007

Linux on my Psion 5MX

I have seen openpsion but this is all debian based and I want to be meaner with the resources I allocate.

So, I'll cross compile myself a kernel, uclibc with toolchain and busybox. This should form a basic system (I think). Anything I've forgotten I'll work out as I go.

Then I want to try to get a graphical environment going. X seems like overkill (even if I just use a DirectFB driver), so I'm currently thinking that GTK on DirectFB might do the job.

GTK on DirectFB has several advantages, for example WxWidgets runs on GTK directly, so I can do some ruby GUI work (using WxRuby, possibly). AbiWord might be useful for word processing (tho' I'm not holding my breath here). So this has my book covered.

I believe there are also GTK based PIM's around, although this is more to do with confidence in the community than actual research!

The final thing I want to do with my psion is work on a parallel language. I think I would choose ANTLR to produce a parser/lexer in C and access this through Objective C (I have a religion that forbids me from touching C++ - call me a 'born again OO coder').

Obviously resources are massively constrained - 256Meg HD, 16Meg memory, 36Mhz processor. But, and let's get real here, I used to code on a 486SX33 (slower) with less memory and less HD (at university). Linux was perfectly happy and X11 was just fine. I'm going to be more stingy than before so I should gain some extra space and possibly a little bit extra processor resource. Here's hoping!

Baby book

As I said earlier, I am writing a book for kids to entice some of them into the world of coding. I think I can get quite far quite quickly - kids have no pre-concieved ideas about what is hard and so won't be put off when I start talking about objects, double buffering, threading and network communications.

What language to choose?
I'm not going to write it in Java, C (or derivatives), etc - it takes too much work to do small things: lots of code, creating files, compilation, shared lib mgt, etc. Java, et al are fine for enterprise level, heavyweight or just professional coding, but not for kids to scratch together little scripty examples. I think I'm saying I want a scripting language, so what other ones are out there?

  • I first thought javascript (ECMAScript really) would be a nice language, but the commandline versions of javascript I have found (on the JVM so I can re-use AWT, etc) have broken scoping rules (Rhino and FESI).

  • Groovy appears to have intentionally broken scoping rules, but that's a conversation for me and a Groovy friend of mine. It's worth noting here that this is as 'far out' of the mainstream as I'm willing to go. I want a recognisably 'real' language. Groovy is right on that boundary for me.

  • Lisp of some form might be nice, but I just feel some of the OO implementations are a bit of a cludge. My experience of lisp (scheme, ELisp and CLisp) was that you start from a long way back (by modern standards).

  • Perl? Just no, ok?

  • Python I just don't like - the whitespace thing just stops me every time. This, I know, is my fault. However, I'm aware that it offers nothing over ruby so ruby wins here.

  • Smalltalk was designed to be a OO, scripty, teaching language. Here is where I think I reject it. I am not after a teaching language, I want a 'real' language that can be used for teaching, one where it is a happy accident that it is suitable for learning to code. Have you opened an smalltalk environment ever? Squeak was the one I tried. Holey moley, was it offputtingly busy?! What I objected to was the mental leap reaquired to 'see' the code behind the pretty UI. Perhaps I'm too oldschool in this respect, but I see code as a distinct artifact. Mixing it into the graphical system is interesting, but I think this confuses the issue too much.



I have a friend willing to do the artwork. I think making it visually appealing will be practically as important at the content. Or in other words, I don't think it would work if either are wrong.

What other issues will I meet? It's always good to look to another's experiences. I found this excellent introduction from Chris Pine, so I an awaiting a copy of his book from Amazon.

Projects

My book is running first in my mind - a book for baby geeks. Age group will probably be 10 to 12ish, give or take. I'm hoping a precosious 7yr old might enjoy it too. I probably picked up my first coding book at about 11, but there seems to be very few, if any options available today. I am choosing Ruby I think. More in a later blog.

Second project is to make my psion into a useable linux machine. I do need to get the flexi fixed first, but then off we go. I want this machine for bacis PIM stuff, writing my book and doing the next thing on the list:

Last: write a computer language and VM for a massiavely parallel system. I've blogged before that I believe this is the way things will be and I want a playground where I can test my thoughts (before the hardware catches up). I should spend some time to identify the issues with the other options (like ERLang, Occam (pi) and more traditional threading models an POSIX threads, java, etc.).

Thursday, October 04, 2007

Parallelisation

From the SICP book, I took the cue to go write a processor.

Ok, I wrote a piece of code that has discreet modules for executing a machine-code of sorts. As I have written before, coders will need to think differently in the not too distant future, so I thought I'd write a little language that could support massive parallelization. The more I thought and experimented (with ANTLR mostly) I found that writing just the language with no real execution environment was hard, and really weird!

I was trying to create just the programmer's mental model with no real silicon support (I'm talking 100 processors, not just "quad core bibble inside" dung ding dung ding). So, the answer is a virtual machine! This way I have as much silicon support as I want (it's virtual silicon after all) and I have something to execute my code. One day, maybe there will be a real mega processor machine, but until that I can play with the ideas without the encumbrance of contemporary languages and libraries. I can also (to varying degrees I suspect) exploit the hard work that went into the libraries of that language I am writing my VM in.

I'm using Java for a number of reasons. I will just deal with performance first. I DON'T CARE! This is my playground. I'll deal with performance when it's an issue. I even reserve the right to re-write everything, because this incarnation is only to allow me to explore some ideas!

I'm using Java because I know it quite well. It's higher level than C, allowing me to think in bigger terms than malloc, pointers etc. It's supported on everything. It's not a crusty old lisp machine where everyone argues about continuation passing and nods sagely about first class functions but no-one ever acknowledges that the libs suck and the non-existent syntax (or sugar as some would call it) makes life just tedious. It's not C++ (thank god). It's not tied to a certain OS manufacturer. It doesn't have the syntax (half ton of aspratame I think) that Perl does. It's not experimental like Ruby, Python or [insert name-on-rails here]. It's not dead like Pascal (or Delphi - who was Borland trying to fool?), Smalltalk, Ada, Eiffel, ML (and random derivatives - Ocaml, anyone). The only thing not to like about Java is that it is the business solution of the day. That is to say, it solves many management issues (politics, time/cost, etc) but goes halfway to solving the technical ones (concise definition of 'what I mean').

Enough about Java - I'm writing the next erlang, so step 4 turned out to be "write a virtual machine". I think steps 1-3 were all "go round in circles until you're dizzy reading well regarded texts and coding totally insufficient things". (For those in the know, view manger was my first step). I think step 5 will be to revisit step 3 with the benefit of a VM (syntax and semantic definitions).