Log in

No account? Create an account
Who, me? [userpic]

[PROGRAMMING] Perils of integrated environments

May 10th, 2005 (02:01 pm)

current mood: disappointed

So I finally got around to trying Smalltalk. I installed Squeak, partly because it's bit-for-bit compatible across platforms (I wanted to be able to write programs on Linux for my kids to run on Mac), and partly because I like their attitude: one major goal of Squeak is maximum hackability, so everything is written in Smalltalk, even the VM. (The VM is written in a subset of Smalltalk that gets compiled to C.)

Smalltalk is an odd language. It dates to 1972; it was the second object-oriented language, and the first in which everything is an object. But it also exhibits some modern traits. You know how one of the major lessons language designers are learning these days is that the libraries matter at least as much as the language? Well, Smalltalk has that in spades: the core language is tiny; pretty much everything is libraries. Even true, false, if, and while are implemented in the class library.

The library, in fact, is what really distinguishes Smalltalk. It was developed at Xerox PARC, for the Alto, the computer for which the GUI was invented. Smalltalk's library includes that first GUI...and the IDE for it. The IDE actually runs in the same environment as your application; you can select pretty much anything on the screen and debug it. There's also a class browser, docs attached to classes, etc. People rave about how the high level of integration shrinks the code-run-debug cycle down to nearly nothing: make a change to a class, and all the instances pick it up immediately. It's nice. It almost makes up for the fact that the online documentation is so sketchy, and that the windowing system doesn't actually window. (Each widget knows its boundaries, but they're strictly advisory; there's nothing keeping you from drawing all over the screen. You don't even get relative coordinates; all drawing is done in screen coordinates.)

However, last night I got a graphic demonstration of why having your editor in a separate process from your application is a Good Thing. Somehow I managed to trigger an infinite loop in the GUI's event processing, and had to kill my app...but the only way to do that was to kill the VM, which included my editor with all my unsaved changes. I lost at least half an hour's work (significant, when I can only manage a couple of hours of hacking a night, 2-3 nights per week). What's worse, this wasn't even the first time I'd hung the VM (even though I'd been using it only 4 days); it was just the first time I'd lost significant amounts of work. This is annoying. I may have to give up on Smalltalk and find another way to build cross-platform apps. I hope I don't have to fall back on Java.

(Update: I decided to keep trying, and now all my work is well and truly lost. It crashed again, and I did "save and quit"...and it saved the crashedness. I will not use this environment any more.)


Posted by: C. Virtue (cvirtue)
Posted at: May 10th, 2005 08:20 pm (UTC)

And people say that geeks can't make smalltalk.

Posted by: Justin du Coeur (jducoeur)
Posted at: May 10th, 2005 09:54 pm (UTC)

Smalltalk was brilliant in its day -- revolutionary, even. But its day was decades ago, and the world has passed it by. Pretty much all of the good ideas in it have since been lifted and placed in many other languages that have benefitted from three decades of evolution.

Ruby, bubbala. Open source, runs on most interesting platforms, has a very good book that is available online, and is *magnificently* elegant, with everything that a modern language should have. It steals the best ideas of pretty much every other language, including Smalltalk. Doesn't run lightning-fast yet, but if you were planning on using Smalltalk, I assume that's not your highest priority. C# is my day-to-day heavy-lifting language, but Ruby is the one I really *like* using. I've studied damned near every language there is, and IMO Ruby is currently the best...

Posted by: Who, me? (metageek)
Posted at: May 11th, 2005 12:07 am (UTC)

But its day was decades ago, and the world has passed it by.

Mmm, mostly, yeah. Some of what Smalltalk does I don't think I've seen elsewhere yet. For example, Smalltalk's block syntax is more powerful than Ruby's (since Ruby permits only one block as an argument to a function), and apparently its metaclass facility is richer than Python's (that's just hearsay, though). But it doesn't have some things that I consider pretty near essential, like a literal syntax for dictionaries, and, as I mentioned, its windowing technology is paleolithic.

Partly, of course, I'm just generally a language junkie--especially since I decided I wanted to design them, too; if I want to come up with something new, I need to know what's been done. :-)

I should look at Ruby, too. However, I don't think it'll solve the problem at hand: it runs on MacOS X, but the only cross-platform GUI available seems to be Tk (workable, but ugly). I might go back to XUL+JavaScript; I used that for one app for the kids, and it was OK. I really don't care for JavaScript, though; it's too ad hoc.

What I really want is to create some sort of Display SVG (analogous to Display Postscript, or Quartz/Display PDF). SVG+JavaScript+DOM is already capable of being an application platform, but it's painful.

I've studied damned near every language there is,

Yeah, me, too (assuming we're being hyperbolic here :-). I've been programming 25 years, and learned, on average, one language per year. Let's see...BASIC, machine language (various), Logo, Pascal, Forth, C, shell-script, Prolog, Object Pascal, Hypertalk, L3, MUSH, C++, elisp, JavaScript, Java, NewtonScript, Postscript, PHP, Perl, SQL, Python, Scheme, Haskell, Standard ML, and now Smalltalk...that's 26. Oh, and trace amounts of FORTRAN. I've managed to avoid the classic clunkers, like COBOL, PL/I, and Ada.

Posted by: Justin du Coeur (jducoeur)
Posted at: May 11th, 2005 01:27 am (UTC)

We have somewhat different lists, although there is obviously a lot of overlap and similar numbers of languages.

I did pay my dues with COBOL -- three years of it working for my father, using Microsoft COBOL back before people had heard of Microsoft. Never, ever again.

OTOH, Ada is an unfairly maligned language -- Ada 83 had problems, but they were mostly because it was too far ahead of its time, with the result that some of the language concepts were a shade half-baked and it was *way* too heavyweight for the compilers of the time. And Ada 95 was a very nice language, far better than most of the alternatives available at the time. Admittedly, though, I'm biased: I was working at Intermetrics when we were leading the language redesign effort, and I spent a couple of years working on CASE tools for Ada 95.

So riddle me this: have you actually been able to do something real with Haskell? I've meaning to really get my hands dirty in it for years, but haven't found an appropriate project. (And no employer ever wants to hear about it...)

Posted by: Who, me? (metageek)
Posted at: May 11th, 2005 12:43 pm (UTC)

So riddle me this: have you actually been able to do something real with Haskell?

Well, no...and I probably won't, now that I know ML. ML has most of the nice attributes of Haskell, except for laziness, and doesn't require you to use monads for I/O. It's really nice for interpreters: if you have a denotational semantics for your language, you can (usually) translate it directly into ML.

(Deleted comment)
Posted by: ((Anonymous))
Posted at: June 8th, 2005 10:29 am (UTC)
Not lost

Your work is probably not lost, Squeak logs all code changes in a log file (blabla.changes) and you can easily get it all back from there. Also, did you try alt-. (equivalent to ctrl-c) to break any loop? Because the VM very seldom hangs.

regards, Göran Krampe

7 Read Comments