Toxic Elephant

I Want Cells-GTK for Ruby

Posted by matijs Mon, 22 Jan 2007 13:21:00 GMT

For some applications, a spreadsheet is the perfect development environment. The UI is a no-brainer, while the relations between the different values is clearly visible, and changes are automatically propagated from what could be called properties to derived values.

The problem is, of course, that you’re missing out on the features a programming language could offer. Macros are basically a dead end, unless you like to solve user issues like ‘It doesn’t work because I disabled all macros.’

What I want is something that gives me this easy linking within a model and between model and UI, but from withing Ruby. It is my prefered solution to the Gnome on Rails problem.

Cells for Common Lisp promises to take care of the automatic propagation and dependencies between cells:

Cells is a mature, stable extension to CLOS that allows you to create classes, the instances of which have slots whose values are determined by a formula. Think of the slots as cells in a spreadsheet (get it?), and you’ve got the right idea. You can use any arbitrary Common Lisp expression to specify the value of a cell. The Cells system takes care of tracking dependencies among cells, and propagating values.

That seems to take care of the automatic updating of derived values. The second part is the no-brain-UI. What’s needed for that is a dead-simple way to link settable values to input widgets (text boxes, spin buttons, etc.), and to link derived cell values to labels. By dead-simple I mean that it should be done in at most one line per widget/value pair.

It seems for that part, the solution would be to use cells-gtk:

Cells transparently link GUI elements with each other and the application model to greatly simplify development of rich interfaces. Cells also automate how Lisp GUI instances drive their GTK+ counterparts.

Sounds great!

The problem (for me at least) is that this is all in Lisp, and I don’t know Lisp yet. So, I want this, but in Ruby (since that’s the language I like to use most right now). Some basic ingredients are already there: We can use blocks as formulas for the derived values, and there’s the Observable module. Also, Ruby has bindings for Gtk+.

I have some more wishes, but they’re mostly about Gtk+, so I leave those till later.

Posted in  | Tags ,  | no comments | no trackbacks

Skipping Python for Ruby

Posted by matijs Thu, 18 Jan 2007 18:59:00 GMT

Without an e writes:

Well, ruby just isn’t that much better than python. If I’m going to relearn everything, why would I bother with ruby? Why not just jump straight to lisp?

I can really appreciate this argument, since it resonates with my reasons for not learning Python: I knew Perl, and was doing most of my programming in it, making nicely structured, readable, object-oriented programs. To me, Python didn’t seem like such a big step forward: It’s like a Perl with enforced readability.

And then came Ruby.

My introduction to Ruby was not through Rails, but through reading the online version of the Pickaxe Book. After reading the first chapter, I was sold. Here was a language that truly embraced object-orientation, and gave access to all kinds of interesting abstractions that I had only vaguely heard of (such as coroutines). There also was a pleasant lack of boilerplate.

So to me, Ruby is that much better than Perl, whereas Python is not. I wouldn’t know if I agree that Ruby is not that much better than Python, but at least I can understand the argument. Ruby is certainly no Lisp, although it comes close.

So what’s next? Lisp’s features certainly look appealing, giving basically the pinnacle of power of abstraction, in exchange for slightly unappealing syntax. I believe the syntax can be overcome, so my next language to learn may well be a Lisp. Which Lisp is still an open question. On the other hand, there are interesting languages like Erlang, ML and the like.

[Incidentally, Without an e is the creator of Scarlet Lambda, which is roughly a web framework written in, or at least used with, a functional style of programming in Python, with a Lisp-like syntax. Wow.]

Posted in  | Tags , , ,  | no comments | no trackbacks

Toxic Elephant is Matijs van Zuijlen's weblog.

Powered

Categories

Archives